summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Configure
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-01-21 19:14:49 (GMT)
committerBrad King <brad.king@kitware.com>2014-01-21 19:14:49 (GMT)
commit82d431750389e521f021772d5d01337b6dc8c0de (patch)
tree575c58211273c0524bb63c1aab253363fefb08eb /Tests/RunCMake/Configure
parent1ef444d67819afc43444b7b501543eeca284b177 (diff)
downloadCMake-82d431750389e521f021772d5d01337b6dc8c0de.zip
CMake-82d431750389e521f021772d5d01337b6dc8c0de.tar.gz
CMake-82d431750389e521f021772d5d01337b6dc8c0de.tar.bz2
Allow projects to specify extra inputs to CMake
Define a new 'CMAKE_CONFIGURE_DEPENDS' directory property that projects can use to specify input files to the CMake configuration process. Extend the RunCMake.Configure test to verify that the build system re-runs CMake when this input changes.
Diffstat (limited to 'Tests/RunCMake/Configure')
-rw-r--r--Tests/RunCMake/Configure/RerunCMake-build1-check.cmake5
-rw-r--r--Tests/RunCMake/Configure/RerunCMake-build2-check.cmake9
-rw-r--r--Tests/RunCMake/Configure/RerunCMake.cmake7
-rw-r--r--Tests/RunCMake/Configure/RerunCMake.txt1
-rw-r--r--Tests/RunCMake/Configure/RunCMakeTest.cmake5
5 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/Configure/RerunCMake-build1-check.cmake b/Tests/RunCMake/Configure/RerunCMake-build1-check.cmake
index 3fb557f..dbf8f67 100644
--- a/Tests/RunCMake/Configure/RerunCMake-build1-check.cmake
+++ b/Tests/RunCMake/Configure/RerunCMake-build1-check.cmake
@@ -2,3 +2,8 @@ file(READ ${stamp} content)
if(NOT content STREQUAL 1)
set(RunCMake_TEST_FAILED "Expected stamp '1' but got: '${content}'")
endif()
+
+file(READ ${output} content)
+if(NOT content STREQUAL 1)
+ set(RunCMake_TEST_FAILED "Expected output '1' but got: '${content}'")
+endif()
diff --git a/Tests/RunCMake/Configure/RerunCMake-build2-check.cmake b/Tests/RunCMake/Configure/RerunCMake-build2-check.cmake
new file mode 100644
index 0000000..a4897e5
--- /dev/null
+++ b/Tests/RunCMake/Configure/RerunCMake-build2-check.cmake
@@ -0,0 +1,9 @@
+file(READ ${stamp} content)
+if(NOT content STREQUAL 2)
+ set(RunCMake_TEST_FAILED "Expected stamp '2' but got: '${content}'")
+endif()
+
+file(READ ${output} content)
+if(NOT content STREQUAL 2)
+ set(RunCMake_TEST_FAILED "Expected output '2' but got: '${content}'")
+endif()
diff --git a/Tests/RunCMake/Configure/RerunCMake.cmake b/Tests/RunCMake/Configure/RerunCMake.cmake
index 854c9a2..5a561bf 100644
--- a/Tests/RunCMake/Configure/RerunCMake.cmake
+++ b/Tests/RunCMake/Configure/RerunCMake.cmake
@@ -2,3 +2,10 @@ set(input ${CMAKE_CURRENT_BINARY_DIR}/CustomCMakeInput.txt)
set(stamp ${CMAKE_CURRENT_BINARY_DIR}/CustomCMakeStamp.txt)
file(READ ${input} content)
file(WRITE ${stamp} "${content}")
+
+set(depend ${CMAKE_CURRENT_BINARY_DIR}/CustomCMakeDepend.txt)
+set(output ${CMAKE_CURRENT_BINARY_DIR}/CustomCMakeOutput.txt)
+set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${depend})
+file(READ ${depend} content)
+file(WRITE ${output} "${content}")
+set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS RerunCMake.txt)
diff --git a/Tests/RunCMake/Configure/RerunCMake.txt b/Tests/RunCMake/Configure/RerunCMake.txt
new file mode 100644
index 0000000..15598c1
--- /dev/null
+++ b/Tests/RunCMake/Configure/RerunCMake.txt
@@ -0,0 +1 @@
+Source-tree dependency for "RerunCMake.cmake".
diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake
index e748498..5ef0384 100644
--- a/Tests/RunCMake/Configure/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake
@@ -10,10 +10,15 @@ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
set(input "${RunCMake_TEST_BINARY_DIR}/CustomCMakeInput.txt")
set(stamp "${RunCMake_TEST_BINARY_DIR}/CustomCMakeStamp.txt")
+set(depend "${RunCMake_TEST_BINARY_DIR}/CustomCMakeDepend.txt")
+set(output "${RunCMake_TEST_BINARY_DIR}/CustomCMakeOutput.txt")
file(WRITE "${input}" "1")
+file(WRITE "${depend}" "1")
run_cmake(RerunCMake)
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
file(WRITE "${input}" "2")
run_cmake_command(RerunCMake-build1 ${CMAKE_COMMAND} --build .)
+file(WRITE "${depend}" "2")
+run_cmake_command(RerunCMake-build2 ${CMAKE_COMMAND} --build .)
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)