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
This commit is contained in:
parent
b6fba35411
commit
7ced0732e8
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -341,6 +341,8 @@ private:
|
|||
const std::vector<std::string>& relFiles,
|
||||
std::vector<std::string>& absFiles);
|
||||
bool CheckCMP0006(bool& failure);
|
||||
|
||||
std::string DefaultComponentName;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,7 +58,8 @@ bool cmInstallTargetsCommand
|
|||
}
|
||||
|
||||
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
|
||||
->AddInstallComponent("Unspecified");
|
||||
->AddInstallComponent(this->Makefile->GetSafeDefinition(
|
||||
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue