mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-01 11:22:21 -06:00
CPack: Add support for CPACK_PRODUCTBULID_RESOURCES_DIR
This allows you to copy custom files (e.g. a background image) into the macOS installer. Fixes: #16604
This commit is contained in:
7
Help/release/dev/productbuild_resources.rst
Normal file
7
Help/release/dev/productbuild_resources.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
productbuild_resources
|
||||
----------------------
|
||||
|
||||
* The :module:`CPackProductBuild` module gained a new
|
||||
:variable:`CPACK_PRODUCTBUILD_RESOURCES_DIR` variable to
|
||||
specify resources to be copied into the ``Resources``
|
||||
directory.
|
||||
@@ -46,3 +46,11 @@
|
||||
#
|
||||
# Specify a specific keychain to search for the signing identity.
|
||||
#
|
||||
#
|
||||
# .. variable:: CPACK_PRODUCTBUILD_RESOURCES_DIR
|
||||
#
|
||||
# If specified the productbuild generator copies files from this directory
|
||||
# (including subdirectories) to the ``Resources`` directory. This is done
|
||||
# before the :variable:`CPACK_RESOURCE_FILE_WELCOME`,
|
||||
# :variable:`CPACK_RESOURCE_FILE_README`, and
|
||||
# :variable:`CPACK_RESOURCE_FILE_LICENSE` files are copied.
|
||||
|
||||
@@ -59,12 +59,25 @@ int cmCPackProductBuildGenerator::PackageFiles()
|
||||
}
|
||||
}
|
||||
|
||||
// Copy or create all of the resource files we need.
|
||||
std::string resDir = packageDirFileName + "/Contents";
|
||||
|
||||
if (this->IsSet("CPACK_PRODUCTBUILD_RESOURCES_DIR")) {
|
||||
std::string userResDir =
|
||||
this->GetOption("CPACK_PRODUCTBUILD_RESOURCES_DIR");
|
||||
|
||||
if (!cmSystemTools::CopyADirectory(userResDir, resDir)) {
|
||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files"
|
||||
<< std::endl);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy or create all of the resource files we need.
|
||||
if (!this->CopyCreateResourceFile("License", resDir) ||
|
||||
!this->CopyCreateResourceFile("ReadMe", resDir) ||
|
||||
!this->CopyCreateResourceFile("Welcome", resDir)) {
|
||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files"
|
||||
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
||||
"Problem copying the License, ReadMe and Welcome files"
|
||||
<< std::endl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user