summaryrefslogtreecommitdiffstats
path: root/Tests/ExternalProjectLocal/Step1Patch.cmake
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2014-07-03 16:11:49 (GMT)
committerRolf Eike Beer <eike@sf-mail.de>2014-07-03 16:12:08 (GMT)
commit92af3664c922b4b3127700c426a01ab5fec097b8 (patch)
treeeef069a8d13317f3557462ee53c52834ce1c26c1 /Tests/ExternalProjectLocal/Step1Patch.cmake
parent6d1ad670771271bbdd7e3ff3bfa19474049cc139 (diff)
downloadCMake-92af3664c922b4b3127700c426a01ab5fec097b8.zip
CMake-92af3664c922b4b3127700c426a01ab5fec097b8.tar.gz
CMake-92af3664c922b4b3127700c426a01ab5fec097b8.tar.bz2
Tests: split the ExternalProject test
Move the subtests that test with local projects into their own test. The reason is that on slower or crowded machines the test may reach the limit of 25 minutes and therefore fail while it would pass if it was given enough time. The split is roughly 3:1 with regard to the execution time, with the new ExternalProjectLocal test being the faster one.
Diffstat (limited to 'Tests/ExternalProjectLocal/Step1Patch.cmake')
-rw-r--r--Tests/ExternalProjectLocal/Step1Patch.cmake25
1 files changed, 25 insertions, 0 deletions
diff --git a/Tests/ExternalProjectLocal/Step1Patch.cmake b/Tests/ExternalProjectLocal/Step1Patch.cmake
new file mode 100644
index 0000000..35e09d9
--- /dev/null
+++ b/Tests/ExternalProjectLocal/Step1Patch.cmake
@@ -0,0 +1,25 @@
+# Verify the current working directory.
+if(NOT EXISTS CMakeLists.txt)
+ message(FATAL_ERROR "File does not exist:\n ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt")
+endif()
+if(NOT EXISTS tutorial.cxx)
+ message(FATAL_ERROR "File does not exist:\n ${CMAKE_CURRENT_SOURCE_DIR}/tutorial.cxx")
+endif()
+
+# Check if the patch is already applied.
+file(STRINGS CMakeLists.txt prop_line REGEX "^set_property")
+if(prop_line)
+ message(STATUS "Patch already applied!")
+ return()
+endif()
+
+# Apply the patch.
+file(APPEND CMakeLists.txt "
+# Patch by ExternalProject test:
+set_property(TARGET Tutorial PROPERTY OUTPUT_NAME EP-Tutorial)
+list(LENGTH TEST_LIST len)
+if(NOT len EQUAL 3)
+ message(FATAL_ERROR \"TEST_LIST length is \${len}, not 3\")
+endif()
+")
+message(STATUS "Patched ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt")