diff options
Diffstat (limited to 'Tests/RunCMake/CPack')
7 files changed, 40 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 064b4dc..831f430 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -46,3 +46,4 @@ run_cpack_test_subtests( "MONOLITHIC;COMPONENT" ) run_cpack_test(PROJECT_META "RPM.PROJECT_META;DEB.PROJECT_META" false "MONOLITHIC;COMPONENT") +run_cpack_test_package_target(PRE_POST_SCRIPTS "ZIP" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ExpectedFiles.cmake new file mode 100644 index 0000000..63a36a3 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ExpectedFiles.cmake @@ -0,0 +1,19 @@ +set(SATU "/satu;/satu/CMakeLists.txt") +set(DUA "/dua;/dua/CMakeLists.txt") + +if(GENERATOR_TYPE STREQUAL ZIP) + set(_ext "zip") +elseif(GENERATOR_TYPE STREQUAL TGZ) + set(_ext "tar.gz") +endif() + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(EXPECTED_FILES_COUNT "2") + set(EXPECTED_FILE_1 "*-satu.${_ext}") + set(EXPECTED_FILE_CONTENT_1_LIST ${SATU}) + set(EXPECTED_FILE_2 "*-dua.${_ext}") + set(EXPECTED_FILE_CONTENT_2_LIST ${DUA}) +else() + set(EXPECTED_FILES_COUNT "1") + set(EXPECTED_FILE_CONTENT_1_LIST ${SATU} ${DUA}) +endif() diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_COMPONENT-stdout.txt b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_COMPONENT-stdout.txt new file mode 100644 index 0000000..319d0da --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_COMPONENT-stdout.txt @@ -0,0 +1,4 @@ +-- The message from .*/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre\.cmake and generator ZIP +.* +-- The message from .*/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post\.cmake and generator ZIP +-- Built packages: .*/_CPack_Packages/.*/pre_post_scripts-.*-dua.zip;.*/_CPack_Packages/.*/pre_post_scripts-.*-satu.zip diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_MONOLITHIC-stdout.txt b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_MONOLITHIC-stdout.txt new file mode 100644 index 0000000..632c4d1 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/ZIP_MONOLITHIC-stdout.txt @@ -0,0 +1,4 @@ +-- The message from .*/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre\.cmake and generator ZIP +.* +-- The message from .*/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post\.cmake and generator ZIP +-- Built packages: .*/_CPack_Packages/.*/pre_post_scripts-0\.1\.1-.*\.zip diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post.cmake b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post.cmake new file mode 100644 index 0000000..cf0b149 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/post.cmake @@ -0,0 +1,2 @@ +message(STATUS "The message from ${CMAKE_CURRENT_LIST_FILE} and generator ${CPACK_GENERATOR}") +message(STATUS "Built packages: ${CPACK_PACKAGE_FILES}") diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre.cmake b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre.cmake new file mode 100644 index 0000000..b04aa6b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/pre.cmake @@ -0,0 +1 @@ +message(STATUS "The message from ${CMAKE_CURRENT_LIST_FILE} and generator ${CPACK_GENERATOR}") diff --git a/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/test.cmake b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/test.cmake new file mode 100644 index 0000000..f1b6d5f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PRE_POST_SCRIPTS/test.cmake @@ -0,0 +1,9 @@ +install(FILES CMakeLists.txt DESTINATION satu COMPONENT satu) +install(FILES CMakeLists.txt DESTINATION dua COMPONENT dua) + +set(CPACK_PRE_BUILD_SCRIPTS "${CMAKE_CURRENT_LIST_DIR}/pre.cmake") +set(CPACK_POST_BUILD_SCRIPTS "${CMAKE_CURRENT_LIST_DIR}/post.cmake") + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENTS_ALL satu dua) +endif() |