diff options
author | Brad King <brad.king@kitware.com> | 2020-10-26 14:28:09 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-10-26 14:28:30 (GMT) |
commit | a1fe3be2bf93d5ff145ede509db6c454870d979f (patch) | |
tree | 390f450b835f85f5fc21fad2ceff775974a7d6e4 /Tests | |
parent | 6335b67c802c255d1b133238af234c77c00bf0ef (diff) | |
parent | cd33bfcad57eca7c32d3f8e3260d9a6682c5d516 (diff) | |
download | CMake-a1fe3be2bf93d5ff145ede509db6c454870d979f.zip CMake-a1fe3be2bf93d5ff145ede509db6c454870d979f.tar.gz CMake-a1fe3be2bf93d5ff145ede509db6c454870d979f.tar.bz2 |
Merge topic 'per-config-source-TARGET_FILE' into release-3.19
cd33bfcad5 add_custom_command: Properly recognize if sources depend on config
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5410
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/ConfigSources/CMakeLists.txt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt index 7b1a312..1db00cc 100644 --- a/Tests/ConfigSources/CMakeLists.txt +++ b/Tests/ConfigSources/CMakeLists.txt @@ -91,3 +91,16 @@ target_compile_definitions(ObjLibFromGeneratedSources PRIVATE OBJ_SHARED) target_sources(ObjLibFromGeneratedSources PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/config_$<CONFIG>.cpp) add_library(SharedLibFromObjLibFromGeneratedSources SHARED shared.cpp) target_link_libraries(SharedLibFromObjLibFromGeneratedSources PRIVATE ObjLibFromGeneratedSources) + + +# --------------------------------------------------------------------------- +# Make sure that additional build-events do not confuse CMake when using generated files. +add_library(SharedLibFromGeneratedSources SHARED) +set_property(TARGET SharedLibFromGeneratedSources PROPERTY POSITION_INDEPENDENT_CODE 1) +target_sources(SharedLibFromGeneratedSources PRIVATE + shared.cpp + ${CMAKE_CURRENT_BINARY_DIR}/config_$<CONFIG>.cpp + ) +add_custom_command(TARGET SharedLibFromGeneratedSources POST_BUILD + COMMAND "${CMAKE_COMMAND}" "-E" "echo" "$<TARGET_FILE:SharedLibFromGeneratedSources>" + ) |