summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2018-06-08 19:08:36 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2018-07-02 13:51:02 (GMT)
commit3ced881db63a97eb402bd68be5e45298371f4519 (patch)
tree9016ef46f73b77dcf3191b1a12b4b534418e1702
parent4938abb6002cb60501a0da651059ca0aefeed24f (diff)
downloadCMake-3ced881db63a97eb402bd68be5e45298371f4519.zip
CMake-3ced881db63a97eb402bd68be5e45298371f4519.tar.gz
CMake-3ced881db63a97eb402bd68be5e45298371f4519.tar.bz2
cmCPackGenerator: Store CPACK_INSTALL_CMAKE_PROJECTS in an internal field
By storing this information in an internal field in the class, it can be used later on by generators that need it.
-rw-r--r--Source/CPack/cmCPackComponentGroup.h25
-rw-r--r--Source/CPack/cmCPackGenerator.cxx30
-rw-r--r--Source/CPack/cmCPackGenerator.h1
3 files changed, 45 insertions, 11 deletions
diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h
index f2907db..bb980d7 100644
--- a/Source/CPack/cmCPackComponentGroup.h
+++ b/Source/CPack/cmCPackComponentGroup.h
@@ -143,4 +143,29 @@ public:
std::vector<cmCPackComponentGroup*> Subgroups;
};
+/** \class cmCPackInstallCMakeProject
+ * \brief A single quadruplet from the CPACK_INSTALL_CMAKE_PROJECTS variable.
+ */
+class cmCPackInstallCMakeProject
+{
+public:
+ /// The directory of the CMake project.
+ std::string Directory;
+
+ /// The name of the CMake project.
+ std::string ProjectName;
+
+ /// The name of the component (or component set) to install.
+ std::string Component;
+
+ /// The subdirectory to install into.
+ std::string SubDirectory;
+
+ /// The list of installation types.
+ std::vector<cmCPackInstallationType*> InstallationTypes;
+
+ /// The list of components.
+ std::vector<cmCPackComponent*> Components;
+};
+
#endif
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 6924873..7014676 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -545,9 +545,13 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
++it;
std::string installProjectName = *it;
++it;
- std::string installComponent = *it;
+ cmCPackInstallCMakeProject project;
+
+ project.Directory = installDirectory;
+ project.ProjectName = installProjectName;
+ project.Component = *it;
++it;
- std::string installSubDirectory = *it;
+ project.SubDirectory = *it;
std::vector<std::string> componentsVector;
@@ -562,30 +566,32 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
!(this->IsOn("CPACK_MONOLITHIC_INSTALL"))) {
// Determine the installation types for this project (if provided).
std::string installTypesVar = "CPACK_" +
- cmSystemTools::UpperCase(installComponent) + "_INSTALL_TYPES";
+ cmSystemTools::UpperCase(project.Component) + "_INSTALL_TYPES";
const char* installTypes = this->GetOption(installTypesVar);
if (installTypes && *installTypes) {
std::vector<std::string> installTypesVector;
cmSystemTools::ExpandListArgument(installTypes, installTypesVector);
for (std::string const& installType : installTypesVector) {
- this->GetInstallationType(installProjectName, installType);
+ project.InstallationTypes.push_back(
+ this->GetInstallationType(project.ProjectName, installType));
}
}
// Determine the set of components that will be used in this project
std::string componentsVar =
- "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(installComponent);
+ "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(project.Component);
const char* components = this->GetOption(componentsVar);
if (components && *components) {
cmSystemTools::ExpandListArgument(components, componentsVector);
for (std::string const& comp : componentsVector) {
- GetComponent(installProjectName, comp);
+ project.Components.push_back(
+ this->GetComponent(project.ProjectName, comp));
}
componentInstall = true;
}
}
if (componentsVector.empty()) {
- componentsVector.push_back(installComponent);
+ componentsVector.push_back(project.Component);
}
const char* buildConfigCstr = this->GetOption("CPACK_BUILD_CONFIG");
@@ -605,7 +611,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// on windows.
cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths());
- if (!this->RunPreinstallTarget(installProjectName, installDirectory,
+ if (!this->RunPreinstallTarget(project.ProjectName, project.Directory,
globalGenerator, buildConfig)) {
return 0;
}
@@ -613,17 +619,19 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
delete globalGenerator;
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
- "- Install project: " << installProjectName << std::endl);
+ "- Install project: " << project.ProjectName << std::endl);
// Run the installation for each component
for (std::string const& component : componentsVector) {
if (!this->InstallCMakeProject(
- setDestDir, installDirectory, baseTempInstallDirectory,
+ setDestDir, project.Directory, baseTempInstallDirectory,
default_dir_mode, component, componentInstall,
- installSubDirectory, buildConfig, absoluteDestFiles)) {
+ project.SubDirectory, buildConfig, absoluteDestFiles)) {
return 0;
}
}
+
+ this->CMakeProjects.push_back(project);
}
}
this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES",
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 9128f36..c13c649 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -283,6 +283,7 @@ protected:
*/
std::vector<std::string> files;
+ std::vector<cmCPackInstallCMakeProject> CMakeProjects;
std::map<std::string, cmCPackInstallationType> InstallationTypes;
/**
* The set of components.