mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 03:39:43 -06:00
Add a target property that will be read on unity file generation to attempt to use a relative path to the source file from the CMake Source Directory or the generated unity file. Additionally add the CMake Source Directory and the CMake Binary directory to the include path of the generated unity files. Closes: #26352
14 lines
375 B
CMake
14 lines
375 B
CMake
project(unitybuild_c_absolute_path C)
|
|
|
|
set(srcs "")
|
|
foreach(s RANGE 1 3)
|
|
set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
|
|
file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
|
|
list(APPEND srcs "${src}")
|
|
endforeach()
|
|
|
|
add_library(tgt SHARED ${srcs})
|
|
|
|
set_target_properties(tgt PROPERTIES UNITY_BUILD ON
|
|
UNITY_BUILD_RELOCATABLE FALSE)
|