summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake')
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake31
1 files changed, 31 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake
new file mode 100644
index 000000000..6f7c4c224
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake
@@ -0,0 +1,31 @@
+message("This script could run an external packaging tool")
+
+get_property(role GLOBAL PROPERTY CMAKE_ROLE)
+if(NOT role STREQUAL "CPACK")
+ message(SEND_ERROR "CMAKE_ROLE property is \"${role}\", should be \"CPACK\"")
+endif()
+
+function(expect_variable VAR)
+ if(NOT ${VAR})
+ message(FATAL_ERROR "${VAR} is unexpectedly not set")
+ endif()
+endfunction()
+
+function(expect_file FILE)
+ if(NOT EXISTS "${FILE}")
+ message(FATAL_ERROR "${FILE} is unexpectedly missing")
+ endif()
+endfunction()
+
+expect_variable(CPACK_COMPONENTS_ALL)
+expect_variable(CPACK_TOPLEVEL_DIRECTORY)
+expect_variable(CPACK_TEMPORARY_DIRECTORY)
+expect_variable(CPACK_PACKAGE_DIRECTORY)
+expect_variable(CPACK_PACKAGE_FILE_NAME)
+
+expect_file(${CPACK_TEMPORARY_DIRECTORY}/f1/share/cpack-test/f1.txt)
+expect_file(${CPACK_TEMPORARY_DIRECTORY}/f2/share/cpack-test/f2.txt)
+expect_file(${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt)
+expect_file(${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt)
+
+message(STATUS "This status message is expected to be visible")