summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2012-05-13 13:44:37 (GMT)
committerAlex Neundorf <neundorf@kde.org>2012-05-14 20:19:12 (GMT)
commit7ced0732e875ab7cf4797ef33bd4b897bc41eb53 (patch)
tree8686f60bb78535f916ba5dfeec553cc9b2095cef
parentb6fba35411053e334072a1203493140c67f3d30a (diff)
downloadCMake-7ced0732e875ab7cf4797ef33bd4b897bc41eb53.zip
CMake-7ced0732e875ab7cf4797ef33bd4b897bc41eb53.tar.gz
CMake-7ced0732e875ab7cf4797ef33bd4b897bc41eb53.tar.bz2
make default install component name configurable
Until now an unnamed component was always named "Unspecified". Now this name is taken from the new cmake variable CMAKE_INSTALL_DEFAULT_COMPONENT_NAME, which is initialized to "Unspecified". But it can now be set to something project-specific, per directory Alex
-rw-r--r--Modules/CMakeGenericSystem.cmake4
-rw-r--r--Source/cmInstallCommand.cxx33
-rw-r--r--Source/cmInstallCommand.h2
-rw-r--r--Source/cmInstallCommandArguments.cxx7
-rw-r--r--Source/cmInstallCommandArguments.h3
-rw-r--r--Source/cmInstallFilesCommand.cxx8
-rw-r--r--Source/cmInstallProgramsCommand.cxx8
-rw-r--r--Source/cmInstallTargetsCommand.cxx3
8 files changed, 45 insertions, 23 deletions
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
index 45d1fbf..6c61d3d 100644
--- a/Modules/CMakeGenericSystem.cmake
+++ b/Modules/CMakeGenericSystem.cmake
@@ -168,6 +168,10 @@ ELSE(CMAKE_HOST_UNIX)
SET(CMAKE_GENERIC_PROGRAM_FILES)
ENDIF(CMAKE_HOST_UNIX)
+# Set a variable which will be used as component name in install() commands
+# where no COMPONENT has been given:
+SET(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "Unspecified")
+
MARK_AS_ADVANCED(
CMAKE_SKIP_RPATH
CMAKE_SKIP_INSTALL_RPATH
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index d8522ee..4016734 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -55,6 +55,13 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->GetLocalGenerator()
->GetGlobalGenerator()->EnableInstallTarget();
+ this->DefaultComponentName = this->Makefile->GetSafeDefinition(
+ "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
+ if (this->DefaultComponentName.empty())
+ {
+ this->DefaultComponentName = "Unspecified";
+ }
+
// Switch among the command modes.
if(args[0] == "SCRIPT")
{
@@ -95,7 +102,7 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
//----------------------------------------------------------------------------
bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
{
- std::string component("Unspecified");
+ std::string component = this->DefaultComponentName;
int componentCount = 0;
bool doing_script = false;
bool doing_code = false;
@@ -222,7 +229,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// ARCHIVE, RUNTIME etc. (see above)
// These generic args also contain the targets and the export stuff
std::vector<std::string> unknownArgs;
- cmInstallCommandArguments genericArgs;
+ cmInstallCommandArguments genericArgs(this->DefaultComponentName);
cmCAStringVector targetList(&genericArgs.Parser, "TARGETS");
cmCAString exports(&genericArgs.Parser,"EXPORT", &genericArgs.ArgumentGroup);
targetList.Follows(0);
@@ -230,14 +237,14 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
genericArgs.Parse(&genericArgVector.GetVector(), &unknownArgs);
bool success = genericArgs.Finalize();
- cmInstallCommandArguments archiveArgs;
- cmInstallCommandArguments libraryArgs;
- cmInstallCommandArguments runtimeArgs;
- cmInstallCommandArguments frameworkArgs;
- cmInstallCommandArguments bundleArgs;
- cmInstallCommandArguments privateHeaderArgs;
- cmInstallCommandArguments publicHeaderArgs;
- cmInstallCommandArguments resourceArgs;
+ cmInstallCommandArguments archiveArgs(this->DefaultComponentName);
+ cmInstallCommandArguments libraryArgs(this->DefaultComponentName);
+ cmInstallCommandArguments runtimeArgs(this->DefaultComponentName);
+ cmInstallCommandArguments frameworkArgs(this->DefaultComponentName);
+ cmInstallCommandArguments bundleArgs(this->DefaultComponentName);
+ cmInstallCommandArguments privateHeaderArgs(this->DefaultComponentName);
+ cmInstallCommandArguments publicHeaderArgs(this->DefaultComponentName);
+ cmInstallCommandArguments resourceArgs(this->DefaultComponentName);
// now parse the args for specific parts of the target (e.g. LIBRARY,
// RUNTIME, ARCHIVE etc.
@@ -788,7 +795,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
{
// This is the FILES mode.
bool programs = (args[0] == "PROGRAMS");
- cmInstallCommandArguments ica;
+ cmInstallCommandArguments ica(this->DefaultComponentName);
cmCAStringVector files(&ica.Parser, programs ? "PROGRAMS" : "FILES");
files.Follows(0);
ica.ArgumentGroup.Follows(&files);
@@ -865,7 +872,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
std::string permissions_file;
std::string permissions_dir;
std::vector<std::string> configurations;
- std::string component = "Unspecified";
+ std::string component = this->DefaultComponentName;
std::string literal_args;
for(unsigned int i=1; i < args.size(); ++i)
{
@@ -1179,7 +1186,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
{
// This is the EXPORT mode.
- cmInstallCommandArguments ica;
+ cmInstallCommandArguments ica(this->DefaultComponentName);
cmCAString exp(&ica.Parser, "EXPORT");
cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup);
cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup);
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index ee22523..bf9fd9e 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -341,6 +341,8 @@ private:
const std::vector<std::string>& relFiles,
std::vector<std::string>& absFiles);
bool CheckCMP0006(bool& failure);
+
+ std::string DefaultComponentName;
};
diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx
index f508594..0ba21c7 100644
--- a/Source/cmInstallCommandArguments.cxx
+++ b/Source/cmInstallCommandArguments.cxx
@@ -23,7 +23,8 @@ const char* cmInstallCommandArguments::PermissionsTable[] =
const std::string cmInstallCommandArguments::EmptyString;
-cmInstallCommandArguments::cmInstallCommandArguments()
+cmInstallCommandArguments::cmInstallCommandArguments(
+ const std::string& defaultComponent)
:Parser()
,ArgumentGroup()
,Destination (&Parser, "DESTINATION" , &ArgumentGroup)
@@ -35,7 +36,9 @@ cmInstallCommandArguments::cmInstallCommandArguments()
,NamelinkOnly (&Parser, "NAMELINK_ONLY" , &ArgumentGroup)
,NamelinkSkip (&Parser, "NAMELINK_SKIP" , &ArgumentGroup)
,GenericArguments(0)
-{}
+{
+ this->Component.SetDefaultString(defaultComponent.c_str());
+}
const std::string& cmInstallCommandArguments::GetDestination() const
{
diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h
index 53f13c0..321454a 100644
--- a/Source/cmInstallCommandArguments.h
+++ b/Source/cmInstallCommandArguments.h
@@ -19,7 +19,7 @@
class cmInstallCommandArguments
{
public:
- cmInstallCommandArguments();
+ cmInstallCommandArguments(const std::string& defaultComponent);
void SetGenericArguments(cmInstallCommandArguments* args)
{this->GenericArguments = args;}
void Parse(const std::vector<std::string>* args,
@@ -45,6 +45,7 @@ class cmInstallCommandArguments
cmCommandArgumentsHelper Parser;
cmCommandArgumentGroup ArgumentGroup;
private:
+ cmInstallCommandArguments(); // disabled
cmCAString Destination;
cmCAString Component;
cmCAString Rename;
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 85400a1..cc62c4b 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -55,7 +55,8 @@ bool cmInstallFilesCommand
}
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
- ->AddInstallComponent("Unspecified");
+ ->AddInstallComponent(this->Makefile->GetSafeDefinition(
+ "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
return true;
}
@@ -128,13 +129,14 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
// Use a file install generator.
const char* no_permissions = "";
const char* no_rename = "";
- const char* no_component = "Unspecified";
+ std::string no_component = this->Makefile->GetSafeDefinition(
+ "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations;
this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(this->Files,
destination.c_str(), false,
no_permissions, no_configurations,
- no_component, no_rename));
+ no_component.c_str(), no_rename));
}
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 61ac741..3a0a322 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -34,7 +34,8 @@ bool cmInstallProgramsCommand
}
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
- ->AddInstallComponent("Unspecified");
+ ->AddInstallComponent(this->Makefile->GetSafeDefinition(
+ "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
return true;
}
@@ -89,13 +90,14 @@ void cmInstallProgramsCommand::FinalPass()
// Use a file install generator.
const char* no_permissions = "";
const char* no_rename = "";
- const char* no_component = "Unspecified";
+ std::string no_component = this->Makefile->GetSafeDefinition(
+ "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations;
this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(this->Files,
destination.c_str(), true,
no_permissions, no_configurations,
- no_component, no_rename));
+ no_component.c_str(), no_rename));
}
/**
diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx
index 27fc175..277ccea 100644
--- a/Source/cmInstallTargetsCommand.cxx
+++ b/Source/cmInstallTargetsCommand.cxx
@@ -58,7 +58,8 @@ bool cmInstallTargetsCommand
}
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
- ->AddInstallComponent("Unspecified");
+ ->AddInstallComponent(this->Makefile->GetSafeDefinition(
+ "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
return true;
}