Commit d32f9deb authored by Tim Hutt's avatar Tim Hutt Committed by Brad King
Browse files

CPack: Add option to specify --component-plist for productbuild

When using the productbuild generator this lets you specify the value of
the `--component-plist` parameter when it runs pkgbuild for a component.

Fixes: #16638
parent 11e96051
productbuild_component_plist
----------------------------
* The :module:`CPackComponent` module :command:`cpack_add_component` command
gained a new ``PLIST <filename>`` option to specify the ``pkgbuild``
``--component-plist`` argument when using the
:module:`productbuild <CPackProductBuild>` generator.
......@@ -105,7 +105,8 @@
# [DEPENDS comp1 comp2 ... ]
# [INSTALL_TYPES type1 type2 ... ]
# [DOWNLOADED]
# [ARCHIVE_FILE filename])
# [ARCHIVE_FILE filename]
# [PLIST filename])
#
#
#
......@@ -163,6 +164,9 @@
# a file with some name based on CPACK_PACKAGE_FILE_NAME and the name of
# the component. See cpack_configure_downloads for more information.
#
# PLIST gives a filename that is passed to pkgbuild with the
# ``--component-plist`` argument when using the productbuild generator.
#
# .. command:: cpack_add_component_group
#
# Describes a group of related CPack installation components.
......@@ -389,7 +393,7 @@ endmacro()
macro(cpack_add_component compname)
string(TOUPPER ${compname} _CPACK_ADDCOMP_UNAME)
cpack_parse_arguments(CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}
"DISPLAY_NAME;DESCRIPTION;GROUP;DEPENDS;INSTALL_TYPES;ARCHIVE_FILE"
"DISPLAY_NAME;DESCRIPTION;GROUP;DEPENDS;INSTALL_TYPES;ARCHIVE_FILE;PLIST"
"HIDDEN;REQUIRED;DISABLED;DOWNLOADED"
${ARGN}
)
......@@ -445,6 +449,9 @@ macro(cpack_add_component compname)
cpack_append_option_set_command(
CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_DOWNLOADED
_CPACK_ADDCOMP_STR)
cpack_append_string_variable_set_command(
CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_PLIST
_CPACK_ADDCOMP_STR)
# Backward compatibility issue.
# Write to config iff the macros is used after CPack.cmake has been
# included, other it's not necessary because the variables
......
......@@ -78,6 +78,10 @@ public:
/// contains the files that are part of this component.
std::string ArchiveFile;
/// The file to pass to --component-plist when using the
/// productbuild generator.
std::string Plist;
/// The components that this component depends on.
std::vector<cmCPackComponent*> Dependencies;
......
......@@ -1396,6 +1396,11 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
component->ArchiveFile = archiveFile;
}
const char* plist = this->GetOption(macroPrefix + "_PLIST");
if (plist && *plist) {
component->Plist = plist;
}
const char* groupName = this->GetOption(macroPrefix + "_GROUP");
if (groupName && *groupName) {
component->Group = GetComponentGroup(projectName, groupName);
......
......@@ -223,6 +223,10 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
: " --keychain \"" + keychainPath + "\"")
<< " \"" << packageFile << "\"";
if (component && !component->Plist.empty()) {
pkgCmd << " --component-plist \"" << component->Plist << "\"";
}
// Run ProductBuild
return RunProductBuild(pkgCmd.str());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment