diff options
Diffstat (limited to 'Tests/RunCMake/BuildDepends')
-rw-r--r-- | Tests/RunCMake/BuildDepends/RepeatCMake-Custom-Script.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/BuildDepends/RepeatCMake-Custom.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/BuildDepends/RunCMakeTest.cmake | 17 |
3 files changed, 26 insertions, 0 deletions
diff --git a/Tests/RunCMake/BuildDepends/RepeatCMake-Custom-Script.cmake b/Tests/RunCMake/BuildDepends/RepeatCMake-Custom-Script.cmake new file mode 100644 index 0000000..3e953b3 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/RepeatCMake-Custom-Script.cmake @@ -0,0 +1,4 @@ +if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/exists-for-build2") + message(FATAL_ERROR "Custom command incorrectly re-ran after CMake re-ran!") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/out.txt") diff --git a/Tests/RunCMake/BuildDepends/RepeatCMake-Custom.cmake b/Tests/RunCMake/BuildDepends/RepeatCMake-Custom.cmake new file mode 100644 index 0000000..697e485 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/RepeatCMake-Custom.cmake @@ -0,0 +1,5 @@ +add_custom_command(OUTPUT out.txt + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_LIST_DIR}/RepeatCMake-Custom-Script.cmake + DEPENDS ${CMAKE_CURRENT_LIST_DIR}/RepeatCMake-Custom-Script.cmake + ) +add_custom_target(drive ALL DEPENDS out.txt) diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 7a68c4b..6c6d548 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -70,6 +70,23 @@ if(RunCMake_GENERATOR MATCHES "Make") endif() endif() +function(run_RepeatCMake CASE) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build) + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_CONFIGURATION_TYPES=Debug) + else() + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + run_cmake(${CASE}) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${CASE}-build1 ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(${CASE}-rerun1 ${CMAKE_COMMAND} .) + file(WRITE ${RunCMake_TEST_BINARY_DIR}/exists-for-build2 "") + run_cmake_command(${CASE}-build2 ${CMAKE_COMMAND} --build . --config Debug) +endfunction() + +run_RepeatCMake(RepeatCMake-Custom) + function(run_ReGeneration) # test re-generation of project even if CMakeLists.txt files disappeared |