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)
|
SET(CMAKE_GENERIC_PROGRAM_FILES)
|
||||||
ENDIF(CMAKE_HOST_UNIX)
|
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(
|
MARK_AS_ADVANCED(
|
||||||
CMAKE_SKIP_RPATH
|
CMAKE_SKIP_RPATH
|
||||||
CMAKE_SKIP_INSTALL_RPATH
|
CMAKE_SKIP_INSTALL_RPATH
|
||||||
|
|
|
@ -55,6 +55,13 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
|
||||||
this->Makefile->GetLocalGenerator()
|
this->Makefile->GetLocalGenerator()
|
||||||
->GetGlobalGenerator()->EnableInstallTarget();
|
->GetGlobalGenerator()->EnableInstallTarget();
|
||||||
|
|
||||||
|
this->DefaultComponentName = this->Makefile->GetSafeDefinition(
|
||||||
|
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
|
||||||
|
if (this->DefaultComponentName.empty())
|
||||||
|
{
|
||||||
|
this->DefaultComponentName = "Unspecified";
|
||||||
|
}
|
||||||
|
|
||||||
// Switch among the command modes.
|
// Switch among the command modes.
|
||||||
if(args[0] == "SCRIPT")
|
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)
|
bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
|
||||||
{
|
{
|
||||||
std::string component("Unspecified");
|
std::string component = this->DefaultComponentName;
|
||||||
int componentCount = 0;
|
int componentCount = 0;
|
||||||
bool doing_script = false;
|
bool doing_script = false;
|
||||||
bool doing_code = false;
|
bool doing_code = false;
|
||||||
|
@ -222,7 +229,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
||||||
// ARCHIVE, RUNTIME etc. (see above)
|
// ARCHIVE, RUNTIME etc. (see above)
|
||||||
// These generic args also contain the targets and the export stuff
|
// These generic args also contain the targets and the export stuff
|
||||||
std::vector<std::string> unknownArgs;
|
std::vector<std::string> unknownArgs;
|
||||||
cmInstallCommandArguments genericArgs;
|
cmInstallCommandArguments genericArgs(this->DefaultComponentName);
|
||||||
cmCAStringVector targetList(&genericArgs.Parser, "TARGETS");
|
cmCAStringVector targetList(&genericArgs.Parser, "TARGETS");
|
||||||
cmCAString exports(&genericArgs.Parser,"EXPORT", &genericArgs.ArgumentGroup);
|
cmCAString exports(&genericArgs.Parser,"EXPORT", &genericArgs.ArgumentGroup);
|
||||||
targetList.Follows(0);
|
targetList.Follows(0);
|
||||||
|
@ -230,14 +237,14 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
||||||
genericArgs.Parse(&genericArgVector.GetVector(), &unknownArgs);
|
genericArgs.Parse(&genericArgVector.GetVector(), &unknownArgs);
|
||||||
bool success = genericArgs.Finalize();
|
bool success = genericArgs.Finalize();
|
||||||
|
|
||||||
cmInstallCommandArguments archiveArgs;
|
cmInstallCommandArguments archiveArgs(this->DefaultComponentName);
|
||||||
cmInstallCommandArguments libraryArgs;
|
cmInstallCommandArguments libraryArgs(this->DefaultComponentName);
|
||||||
cmInstallCommandArguments runtimeArgs;
|
cmInstallCommandArguments runtimeArgs(this->DefaultComponentName);
|
||||||
cmInstallCommandArguments frameworkArgs;
|
cmInstallCommandArguments frameworkArgs(this->DefaultComponentName);
|
||||||
cmInstallCommandArguments bundleArgs;
|
cmInstallCommandArguments bundleArgs(this->DefaultComponentName);
|
||||||
cmInstallCommandArguments privateHeaderArgs;
|
cmInstallCommandArguments privateHeaderArgs(this->DefaultComponentName);
|
||||||
cmInstallCommandArguments publicHeaderArgs;
|
cmInstallCommandArguments publicHeaderArgs(this->DefaultComponentName);
|
||||||
cmInstallCommandArguments resourceArgs;
|
cmInstallCommandArguments resourceArgs(this->DefaultComponentName);
|
||||||
|
|
||||||
// now parse the args for specific parts of the target (e.g. LIBRARY,
|
// now parse the args for specific parts of the target (e.g. LIBRARY,
|
||||||
// RUNTIME, ARCHIVE etc.
|
// RUNTIME, ARCHIVE etc.
|
||||||
|
@ -788,7 +795,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
|
||||||
{
|
{
|
||||||
// This is the FILES mode.
|
// This is the FILES mode.
|
||||||
bool programs = (args[0] == "PROGRAMS");
|
bool programs = (args[0] == "PROGRAMS");
|
||||||
cmInstallCommandArguments ica;
|
cmInstallCommandArguments ica(this->DefaultComponentName);
|
||||||
cmCAStringVector files(&ica.Parser, programs ? "PROGRAMS" : "FILES");
|
cmCAStringVector files(&ica.Parser, programs ? "PROGRAMS" : "FILES");
|
||||||
files.Follows(0);
|
files.Follows(0);
|
||||||
ica.ArgumentGroup.Follows(&files);
|
ica.ArgumentGroup.Follows(&files);
|
||||||
|
@ -865,7 +872,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
|
||||||
std::string permissions_file;
|
std::string permissions_file;
|
||||||
std::string permissions_dir;
|
std::string permissions_dir;
|
||||||
std::vector<std::string> configurations;
|
std::vector<std::string> configurations;
|
||||||
std::string component = "Unspecified";
|
std::string component = this->DefaultComponentName;
|
||||||
std::string literal_args;
|
std::string literal_args;
|
||||||
for(unsigned int i=1; i < args.size(); ++i)
|
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)
|
bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
|
||||||
{
|
{
|
||||||
// This is the EXPORT mode.
|
// This is the EXPORT mode.
|
||||||
cmInstallCommandArguments ica;
|
cmInstallCommandArguments ica(this->DefaultComponentName);
|
||||||
cmCAString exp(&ica.Parser, "EXPORT");
|
cmCAString exp(&ica.Parser, "EXPORT");
|
||||||
cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup);
|
cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup);
|
||||||
cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup);
|
cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup);
|
||||||
|
|
|
@ -341,6 +341,8 @@ private:
|
||||||
const std::vector<std::string>& relFiles,
|
const std::vector<std::string>& relFiles,
|
||||||
std::vector<std::string>& absFiles);
|
std::vector<std::string>& absFiles);
|
||||||
bool CheckCMP0006(bool& failure);
|
bool CheckCMP0006(bool& failure);
|
||||||
|
|
||||||
|
std::string DefaultComponentName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,8 @@ const char* cmInstallCommandArguments::PermissionsTable[] =
|
||||||
|
|
||||||
const std::string cmInstallCommandArguments::EmptyString;
|
const std::string cmInstallCommandArguments::EmptyString;
|
||||||
|
|
||||||
cmInstallCommandArguments::cmInstallCommandArguments()
|
cmInstallCommandArguments::cmInstallCommandArguments(
|
||||||
|
const std::string& defaultComponent)
|
||||||
:Parser()
|
:Parser()
|
||||||
,ArgumentGroup()
|
,ArgumentGroup()
|
||||||
,Destination (&Parser, "DESTINATION" , &ArgumentGroup)
|
,Destination (&Parser, "DESTINATION" , &ArgumentGroup)
|
||||||
|
@ -35,7 +36,9 @@ cmInstallCommandArguments::cmInstallCommandArguments()
|
||||||
,NamelinkOnly (&Parser, "NAMELINK_ONLY" , &ArgumentGroup)
|
,NamelinkOnly (&Parser, "NAMELINK_ONLY" , &ArgumentGroup)
|
||||||
,NamelinkSkip (&Parser, "NAMELINK_SKIP" , &ArgumentGroup)
|
,NamelinkSkip (&Parser, "NAMELINK_SKIP" , &ArgumentGroup)
|
||||||
,GenericArguments(0)
|
,GenericArguments(0)
|
||||||
{}
|
{
|
||||||
|
this->Component.SetDefaultString(defaultComponent.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& cmInstallCommandArguments::GetDestination() const
|
const std::string& cmInstallCommandArguments::GetDestination() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
class cmInstallCommandArguments
|
class cmInstallCommandArguments
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cmInstallCommandArguments();
|
cmInstallCommandArguments(const std::string& defaultComponent);
|
||||||
void SetGenericArguments(cmInstallCommandArguments* args)
|
void SetGenericArguments(cmInstallCommandArguments* args)
|
||||||
{this->GenericArguments = args;}
|
{this->GenericArguments = args;}
|
||||||
void Parse(const std::vector<std::string>* args,
|
void Parse(const std::vector<std::string>* args,
|
||||||
|
@ -45,6 +45,7 @@ class cmInstallCommandArguments
|
||||||
cmCommandArgumentsHelper Parser;
|
cmCommandArgumentsHelper Parser;
|
||||||
cmCommandArgumentGroup ArgumentGroup;
|
cmCommandArgumentGroup ArgumentGroup;
|
||||||
private:
|
private:
|
||||||
|
cmInstallCommandArguments(); // disabled
|
||||||
cmCAString Destination;
|
cmCAString Destination;
|
||||||
cmCAString Component;
|
cmCAString Component;
|
||||||
cmCAString Rename;
|
cmCAString Rename;
|
||||||
|
|
|
@ -55,7 +55,8 @@ bool cmInstallFilesCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
|
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
|
||||||
->AddInstallComponent("Unspecified");
|
->AddInstallComponent(this->Makefile->GetSafeDefinition(
|
||||||
|
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -128,13 +129,14 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
|
||||||
// Use a file install generator.
|
// Use a file install generator.
|
||||||
const char* no_permissions = "";
|
const char* no_permissions = "";
|
||||||
const char* no_rename = "";
|
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;
|
std::vector<std::string> no_configurations;
|
||||||
this->Makefile->AddInstallGenerator(
|
this->Makefile->AddInstallGenerator(
|
||||||
new cmInstallFilesGenerator(this->Files,
|
new cmInstallFilesGenerator(this->Files,
|
||||||
destination.c_str(), false,
|
destination.c_str(), false,
|
||||||
no_permissions, no_configurations,
|
no_permissions, no_configurations,
|
||||||
no_component, no_rename));
|
no_component.c_str(), no_rename));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,8 @@ bool cmInstallProgramsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
|
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
|
||||||
->AddInstallComponent("Unspecified");
|
->AddInstallComponent(this->Makefile->GetSafeDefinition(
|
||||||
|
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -89,13 +90,14 @@ void cmInstallProgramsCommand::FinalPass()
|
||||||
// Use a file install generator.
|
// Use a file install generator.
|
||||||
const char* no_permissions = "";
|
const char* no_permissions = "";
|
||||||
const char* no_rename = "";
|
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;
|
std::vector<std::string> no_configurations;
|
||||||
this->Makefile->AddInstallGenerator(
|
this->Makefile->AddInstallGenerator(
|
||||||
new cmInstallFilesGenerator(this->Files,
|
new cmInstallFilesGenerator(this->Files,
|
||||||
destination.c_str(), true,
|
destination.c_str(), true,
|
||||||
no_permissions, no_configurations,
|
no_permissions, no_configurations,
|
||||||
no_component, no_rename));
|
no_component.c_str(), no_rename));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -58,7 +58,8 @@ bool cmInstallTargetsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
|
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
|
||||||
->AddInstallComponent("Unspecified");
|
->AddInstallComponent(this->Makefile->GetSafeDefinition(
|
||||||
|
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue