summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorDeniz Bahadir <dbahadir@benocs.com>2020-10-22 21:00:49 (GMT)
committerDeniz Bahadir <dbahadir@benocs.com>2020-10-22 21:03:05 (GMT)
commitcd33bfcad57eca7c32d3f8e3260d9a6682c5d516 (patch)
tree601bedde4189329bc3559a6a4598d0a45995960b /Tests
parent609122007dc074739b394d2f70f674bbccca6073 (diff)
downloadCMake-cd33bfcad57eca7c32d3f8e3260d9a6682c5d516.zip
CMake-cd33bfcad57eca7c32d3f8e3260d9a6682c5d516.tar.gz
CMake-cd33bfcad57eca7c32d3f8e3260d9a6682c5d516.tar.bz2
add_custom_command: Properly recognize if sources depend on config
Fixes: #21349
Diffstat (limited to 'Tests')
-rw-r--r--Tests/ConfigSources/CMakeLists.txt13
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>"
+ )