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 | f87360b78142e49a930ed23868726e279da28abd (patch) | |
tree | ce130673dcd3e5ca2f6f713c42bc39e6cbd4176c /Tests | |
parent | 227018866226afaac741fcd00ec3cc9579163b55 (diff) | |
parent | cd33bfcad57eca7c32d3f8e3260d9a6682c5d516 (diff) | |
download | CMake-f87360b78142e49a930ed23868726e279da28abd.zip CMake-f87360b78142e49a930ed23868726e279da28abd.tar.gz CMake-f87360b78142e49a930ed23868726e279da28abd.tar.bz2 |
Merge topic 'per-config-source-TARGET_FILE'
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>" + ) |