diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/SimpleInstall/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/SimpleInstall/InstallScript1.cmake | 2 | ||||
-rw-r--r-- | Tests/SimpleInstall/InstallScript2.cmake | 9 | ||||
-rw-r--r-- | Tests/SimpleInstallS2/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/SimpleInstallS2/InstallScript1.cmake | 2 | ||||
-rw-r--r-- | Tests/SimpleInstallS2/InstallScript2.cmake | 9 |
6 files changed, 56 insertions, 0 deletions
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index 592cc6b..b238b87 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -19,6 +19,15 @@ IF(STAGE2) SET(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX}) SET(t4NAMES test4 test4${CMAKE_DEBUG_POSTFIX}) + # Make sure the install script ran. + SET(CMAKE_INSTALL_SCRIPT_DID_RUN 0) + INCLUDE(${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake OPTIONAL) + IF(CMAKE_INSTALL_SCRIPT_DID_RUN) + MESSAGE(STATUS "Stage 1 did run install script 2.") + ELSE(CMAKE_INSTALL_SCRIPT_DID_RUN) + MESSAGE(SEND_ERROR "Stage 1 did not run install script 2.") + ENDIF(CMAKE_INSTALL_SCRIPT_DID_RUN) + IF(CYGWIN OR MINGW) SET(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/bin") ENDIF(CYGWIN OR MINGW) @@ -70,6 +79,14 @@ ELSE(STAGE2) INSTALL_TARGETS(/lib test1 test2 test3 test4) INSTALL_FILES(/include FILES lib1.h lib2.h lib3.h) + # Test user-specified install scripts. + INSTALL( + SCRIPT InstallScript1.cmake + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake + ) + SET_DIRECTORY_PROPERTIES(PROPERTIES + ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake) + SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstallExe) # Disable VERSION test until it is implemented in the XCode generator. #SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2) diff --git a/Tests/SimpleInstall/InstallScript1.cmake b/Tests/SimpleInstall/InstallScript1.cmake new file mode 100644 index 0000000..7ce8551 --- /dev/null +++ b/Tests/SimpleInstall/InstallScript1.cmake @@ -0,0 +1,2 @@ +MESSAGE("This is install script 1.") +SET(INSTALL_SCRIPT_1_DID_RUN 1) diff --git a/Tests/SimpleInstall/InstallScript2.cmake b/Tests/SimpleInstall/InstallScript2.cmake new file mode 100644 index 0000000..fdbce81 --- /dev/null +++ b/Tests/SimpleInstall/InstallScript2.cmake @@ -0,0 +1,9 @@ +MESSAGE("This is install script 2.") +IF(INSTALL_SCRIPT_1_DID_RUN) + MESSAGE("Install script ordering works.") +ELSE(INSTALL_SCRIPT_1_DID_RUN) + MESSAGE(FATAL_ERROR "Install script 1 did not run before install script 2.") +ENDIF(INSTALL_SCRIPT_1_DID_RUN) +FILE(WRITE "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake" + "SET(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n" + ) diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index 592cc6b..b238b87 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -19,6 +19,15 @@ IF(STAGE2) SET(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX}) SET(t4NAMES test4 test4${CMAKE_DEBUG_POSTFIX}) + # Make sure the install script ran. + SET(CMAKE_INSTALL_SCRIPT_DID_RUN 0) + INCLUDE(${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake OPTIONAL) + IF(CMAKE_INSTALL_SCRIPT_DID_RUN) + MESSAGE(STATUS "Stage 1 did run install script 2.") + ELSE(CMAKE_INSTALL_SCRIPT_DID_RUN) + MESSAGE(SEND_ERROR "Stage 1 did not run install script 2.") + ENDIF(CMAKE_INSTALL_SCRIPT_DID_RUN) + IF(CYGWIN OR MINGW) SET(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/bin") ENDIF(CYGWIN OR MINGW) @@ -70,6 +79,14 @@ ELSE(STAGE2) INSTALL_TARGETS(/lib test1 test2 test3 test4) INSTALL_FILES(/include FILES lib1.h lib2.h lib3.h) + # Test user-specified install scripts. + INSTALL( + SCRIPT InstallScript1.cmake + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake + ) + SET_DIRECTORY_PROPERTIES(PROPERTIES + ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake) + SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstallExe) # Disable VERSION test until it is implemented in the XCode generator. #SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2) diff --git a/Tests/SimpleInstallS2/InstallScript1.cmake b/Tests/SimpleInstallS2/InstallScript1.cmake new file mode 100644 index 0000000..7ce8551 --- /dev/null +++ b/Tests/SimpleInstallS2/InstallScript1.cmake @@ -0,0 +1,2 @@ +MESSAGE("This is install script 1.") +SET(INSTALL_SCRIPT_1_DID_RUN 1) diff --git a/Tests/SimpleInstallS2/InstallScript2.cmake b/Tests/SimpleInstallS2/InstallScript2.cmake new file mode 100644 index 0000000..fdbce81 --- /dev/null +++ b/Tests/SimpleInstallS2/InstallScript2.cmake @@ -0,0 +1,9 @@ +MESSAGE("This is install script 2.") +IF(INSTALL_SCRIPT_1_DID_RUN) + MESSAGE("Install script ordering works.") +ELSE(INSTALL_SCRIPT_1_DID_RUN) + MESSAGE(FATAL_ERROR "Install script 1 did not run before install script 2.") +ENDIF(INSTALL_SCRIPT_1_DID_RUN) +FILE(WRITE "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake" + "SET(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n" + ) |