summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2020-05-31 20:58:42 (GMT)
committerBrad King <brad.king@kitware.com>2020-06-05 12:56:32 (GMT)
commita6e1b20bab6ab7566a887d43f50c35c112c62b3d (patch)
treef2ec3fa0f121b00ab1a7ee05a7d5afd15bc36d01
parent21218f5c1277ff840e1a7b6128af3b2abe0d35d3 (diff)
downloadCMake-a6e1b20bab6ab7566a887d43f50c35c112c62b3d.zip
CMake-a6e1b20bab6ab7566a887d43f50c35c112c62b3d.tar.gz
CMake-a6e1b20bab6ab7566a887d43f50c35c112c62b3d.tar.bz2
CPack External: Introduce `CPACK_EXTERNAL_BUILT_PACKAGES`
The `CPACK_EXTERNAL_PACKAGE_SCRIPT` script may set this list variable to the full paths of generated package files. CPack copy these files from the stage directory back to the top build directory and possibly produce checksum files if the `CPACK_PACKAGE_CHECKSUM` is set.
-rw-r--r--Help/cpack_gen/external.rst7
-rw-r--r--Help/release/dev/CPACK_EXTERNAL_BUILT_PACKAGES.rst4
-rw-r--r--Source/CPack/cmCPackExternalGenerator.cxx6
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake8
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt10
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake1
6 files changed, 36 insertions, 0 deletions
diff --git a/Help/cpack_gen/external.rst b/Help/cpack_gen/external.rst
index 406f6be..7ef1071 100644
--- a/Help/cpack_gen/external.rst
+++ b/Help/cpack_gen/external.rst
@@ -281,3 +281,10 @@ Variables specific to CPack External generator
It is invoked after (optional) staging took place and may
run an external packaging tool. The script has access to
the variables defined by the CPack config file.
+
+.. variable:: CPACK_EXTERNAL_BUILT_PACKAGES
+
+ The ``CPACK_EXTERNAL_PACKAGE_SCRIPT`` script may set this list variable to the
+ full paths of generated package files. CPack copy these files from the stage
+ directory back to the top build directory and possibly produce checksum files
+ if the :variable:`CPACK_PACKAGE_CHECKSUM` is set.
diff --git a/Help/release/dev/CPACK_EXTERNAL_BUILT_PACKAGES.rst b/Help/release/dev/CPACK_EXTERNAL_BUILT_PACKAGES.rst
new file mode 100644
index 0000000..af446d2
--- /dev/null
+++ b/Help/release/dev/CPACK_EXTERNAL_BUILT_PACKAGES.rst
@@ -0,0 +1,4 @@
+CPACK_EXTERNAL_BUILT_PACKAGES
+-----------------------------
+
+* :cpack_gen:`CPack External Generator` learned the :variable:`CPACK_EXTERNAL_BUILT_PACKAGES` variable.
diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx
index 11e1aec..53be4fe 100644
--- a/Source/CPack/cmCPackExternalGenerator.cxx
+++ b/Source/CPack/cmCPackExternalGenerator.cxx
@@ -75,6 +75,12 @@ int cmCPackExternalGenerator::PackageFiles()
if (cmSystemTools::GetErrorOccuredFlag() || !res) {
return 0;
}
+
+ const char* builtPackagesStr =
+ this->GetOption("CPACK_EXTERNAL_BUILT_PACKAGES");
+ if (builtPackagesStr) {
+ cmExpandList(builtPackagesStr, this->packageFileNames, false);
+ }
}
return 1;
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake
index 6f7c4c2..3db8014 100644
--- a/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake
@@ -29,3 +29,11 @@ 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")
+
+set(
+ CPACK_EXTERNAL_BUILT_PACKAGES
+ ${CPACK_TEMPORARY_DIRECTORY}/f1/share/cpack-test/f1.txt
+ ${CPACK_TEMPORARY_DIRECTORY}/f2/share/cpack-test/f2.txt
+ ${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt
+ ${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt
+ )
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt b/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt
index 37d635f..587b2e8 100644
--- a/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt
@@ -1 +1,11 @@
-- This status message is expected to be visible
+CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/external-0\.1\.1-.*\.json generated\.
+CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/external-0\.1\.1-.*\.json\.sha1 generated\.
+CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f1\.txt generated\.
+CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f1\.txt\.sha1 generated\.
+CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f2\.txt generated\.
+CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f2\.txt\.sha1 generated\.
+CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f3\.txt generated\.
+CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f3\.txt\.sha1 generated\.
+CPack: - package: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f4\.txt generated\.
+CPack: - checksum file: .*/Tests/RunCMake/External/CPack/EXTERNAL-build-stage_and_package-subtest/f4\.txt\.sha1 generated\.
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake
index bc9766b..d4781ba 100644
--- a/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake
@@ -17,6 +17,7 @@ elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_bad")
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package")
set(CPACK_EXTERNAL_ENABLE_STAGING 1)
set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/create_package.cmake")
+ set(CPACK_PACKAGE_CHECKSUM SHA1)
endif()
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" test1)