diff options
author | Craig Scott <craig.scott@crascit.com> | 2019-07-22 11:03:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-07-22 11:04:00 (GMT) |
commit | 9e420754988caa86ebe8835b8fe2d24ff380a59e (patch) | |
tree | 3575907714cd9a1a5d97063840012a1ed0e41530 /Tests | |
parent | f4131e4e1b5ac9ea8940a04b81e7b2ef2fba5d3f (diff) | |
parent | 5f96601675b7b4c1b8d609f31ce39ce35a96a1a5 (diff) | |
download | CMake-9e420754988caa86ebe8835b8fe2d24ff380a59e.zip CMake-9e420754988caa86ebe8835b8fe2d24ff380a59e.tar.gz CMake-9e420754988caa86ebe8835b8fe2d24ff380a59e.tar.bz2 |
Merge topic 'cpack-install-scripts'
5f96601675 CPack: Introduce CPACK_INSTALL_SCRIPTS variable
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3531
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CPack/RunCMakeTest.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/test.cmake | 11 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPTS/ExpectedFiles.cmake (renamed from Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake) | 0 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPTS/both-stderr.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPTS/test.cmake | 26 |
5 files changed, 28 insertions, 12 deletions
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 37df57c..d93f280 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -33,6 +33,6 @@ run_cpack_test(TIMESTAMPS "DEB.TIMESTAMPS;TGZ" false "COMPONENT") unset(ENVIRONMENT) run_cpack_test(USER_FILELIST "RPM.USER_FILELIST" false "MONOLITHIC") run_cpack_test(MD5SUMS "DEB.MD5SUMS" false "MONOLITHIC;COMPONENT") -run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC") +run_cpack_test_subtests(CPACK_INSTALL_SCRIPTS "singular;plural;both" "ZIP" false "MONOLITHIC") run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(EXTERNAL "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "External" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/test.cmake b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/test.cmake deleted file mode 100644 index e3fe0ca..0000000 --- a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/test.cmake +++ /dev/null @@ -1,11 +0,0 @@ -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/abc.txt" "test content") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/user-script.cmake" - "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/foo\" - TYPE FILE FILES \"${CMAKE_CURRENT_BINARY_DIR}/abc.txt\")") -set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/user-script.cmake") - -function(run_after_include_cpack) - file(READ "${CPACK_OUTPUT_CONFIG_FILE}" conf_file_) - string(REGEX REPLACE "SET\\(CPACK_INSTALL_CMAKE_PROJECTS [^)]*\\)" "" conf_file_ "${conf_file_}") - file(WRITE "${CPACK_OUTPUT_CONFIG_FILE}" "${conf_file_}") -endfunction() diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPTS/ExpectedFiles.cmake index 02a7821..02a7821 100644 --- a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPTS/ExpectedFiles.cmake diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPTS/both-stderr.txt b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPTS/both-stderr.txt new file mode 100644 index 0000000..666030e --- /dev/null +++ b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPTS/both-stderr.txt @@ -0,0 +1 @@ +CPack Warning: Both CPACK_INSTALL_SCRIPTS and CPACK_INSTALL_SCRIPT are set, the latter will be ignored. diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPTS/test.cmake b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPTS/test.cmake new file mode 100644 index 0000000..249d2e6 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPTS/test.cmake @@ -0,0 +1,26 @@ +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/abc.txt" "test content") +set(user_script_ "${CMAKE_CURRENT_BINARY_DIR}/user-script.cmake") +file(WRITE "${user_script_}" + "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/foo\" + TYPE FILE FILES \"${CMAKE_CURRENT_BINARY_DIR}/abc.txt\")") + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "both") + set(CPACK_INSTALL_SCRIPT "${user_script_}") + set(CPACK_INSTALL_SCRIPTS "${CPACK_INSTALL_SCRIPT}") + +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "singular") + set(CPACK_INSTALL_SCRIPT "${user_script_}") + +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "plural") + set(CPACK_INSTALL_SCRIPTS "${user_script_}") + +else() + message(FATAL_ERROR "Unexpected subtest name: ${RunCMake_SUBTEST_SUFFIX}") + +endif() + +function(run_after_include_cpack) + file(READ "${CPACK_OUTPUT_CONFIG_FILE}" conf_file_) + string(REGEX REPLACE "SET\\(CPACK_INSTALL_CMAKE_PROJECTS [^)]*\\)" "" conf_file_ "${conf_file_}") + file(WRITE "${CPACK_OUTPUT_CONFIG_FILE}" "${conf_file_}") +endfunction() |