diff options
author | Brad King <brad.king@kitware.com> | 2006-02-10 13:54:36 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-02-10 13:54:36 -0500 |
commit | b8a33fb424aa28b710e0ec170814ac380ee057db (patch) | |
tree | 23c06b61601d90d4703271fed4f90d2d3df7fee7 /Tests | |
parent | d2621064e27e38eba984c994746eaee40bc09ebc (diff) | |
download | cmake-b8a33fb424aa28b710e0ec170814ac380ee057db.tar.gz |
ENH: Added INSTALL command as a placeholder for a future generic install specification interface. Currently it supports only a SCRIPT option specifying a script to run during the install stage.
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 592cc6bd3a..b238b878fa 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 0000000000..7ce8551bd8 --- /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 0000000000..fdbce81d95 --- /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 592cc6bd3a..b238b878fa 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 0000000000..7ce8551bd8 --- /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 0000000000..fdbce81d95 --- /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" + ) |