|
|
@@ -23,25 +23,25 @@
|
|
|
static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target,
|
|
|
const cmInstallCommandArguments& args, bool impLib, bool forceOpt = false)
|
|
|
{
|
|
|
- return new cmInstallTargetGenerator(target, args.GetDestination().c_str(),
|
|
|
- impLib, args.GetPermissions().c_str(),
|
|
|
+ return new cmInstallTargetGenerator(target, args.GetDestination().c_str(),
|
|
|
+ impLib, args.GetPermissions().c_str(),
|
|
|
args.GetConfigurations(), args.GetComponent().c_str(),
|
|
|
args.GetOptional() || forceOpt);
|
|
|
}
|
|
|
|
|
|
static cmInstallFilesGenerator* CreateInstallFilesGenerator(
|
|
|
- const std::vector<std::string>& absFiles,
|
|
|
+ const std::vector<std::string>& absFiles,
|
|
|
const cmInstallCommandArguments& args, bool programs)
|
|
|
{
|
|
|
- return new cmInstallFilesGenerator(absFiles, args.GetDestination().c_str(),
|
|
|
- programs, args.GetPermissions().c_str(),
|
|
|
+ return new cmInstallFilesGenerator(absFiles, args.GetDestination().c_str(),
|
|
|
+ programs, args.GetPermissions().c_str(),
|
|
|
args.GetConfigurations(), args.GetComponent().c_str(),
|
|
|
args.GetRename().c_str(), args.GetOptional());
|
|
|
}
|
|
|
|
|
|
|
|
|
// cmInstallCommand
|
|
|
-bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
|
|
|
+bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
|
|
|
cmExecutionStatus &)
|
|
|
{
|
|
|
// Allow calling with no arguments so that arguments may be built up
|
|
|
@@ -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;
|
|
|
@@ -190,7 +197,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
|
|
|
|
|
|
/*struct InstallPart
|
|
|
{
|
|
|
- InstallPart(cmCommandArgumentsHelper* helper, const char* key,
|
|
|
+ InstallPart(cmCommandArgumentsHelper* helper, const char* key,
|
|
|
cmCommandArgumentGroup* group);
|
|
|
cmCAStringVector argVector;
|
|
|
cmInstallCommandArguments args;
|
|
|
@@ -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,16 +237,16 @@ 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,
|
|
|
+ // now parse the args for specific parts of the target (e.g. LIBRARY,
|
|
|
// RUNTIME, ARCHIVE etc.
|
|
|
archiveArgs.Parse (&archiveArgVector.GetVector(), &unknownArgs);
|
|
|
libraryArgs.Parse (&libraryArgVector.GetVector(), &unknownArgs);
|
|
|
@@ -345,7 +352,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|
|
this->Makefile->IsOn("CYGWIN") ||
|
|
|
this->Makefile->IsOn("MINGW"));
|
|
|
|
|
|
- for(std::vector<std::string>::const_iterator
|
|
|
+ for(std::vector<std::string>::const_iterator
|
|
|
targetIt=targetList.GetVector().begin();
|
|
|
targetIt!=targetList.GetVector().end();
|
|
|
++targetIt)
|
|
|
@@ -422,7 +429,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|
|
case cmTarget::SHARED_LIBRARY:
|
|
|
{
|
|
|
// Shared libraries are handled differently on DLL and non-DLL
|
|
|
- // platforms. All windows platforms are DLL platforms including
|
|
|
+ // platforms. All windows platforms are DLL platforms including
|
|
|
// cygwin. Currently no other platform is a DLL platform.
|
|
|
if(dll_platform)
|
|
|
{
|
|
|
@@ -436,13 +443,13 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|
|
if(!archiveArgs.GetDestination().empty())
|
|
|
{
|
|
|
// The import library uses the ARCHIVE properties.
|
|
|
- archiveGenerator = CreateInstallTargetGenerator(target,
|
|
|
+ archiveGenerator = CreateInstallTargetGenerator(target,
|
|
|
archiveArgs, true);
|
|
|
}
|
|
|
if(!runtimeArgs.GetDestination().empty())
|
|
|
{
|
|
|
// The DLL uses the RUNTIME properties.
|
|
|
- runtimeGenerator = CreateInstallTargetGenerator(target,
|
|
|
+ runtimeGenerator = CreateInstallTargetGenerator(target,
|
|
|
runtimeArgs, false);
|
|
|
}
|
|
|
if ((archiveGenerator==0) && (runtimeGenerator==0))
|
|
|
@@ -467,7 +474,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|
|
// Use the FRAMEWORK properties.
|
|
|
if (!frameworkArgs.GetDestination().empty())
|
|
|
{
|
|
|
- frameworkGenerator = CreateInstallTargetGenerator(target,
|
|
|
+ frameworkGenerator = CreateInstallTargetGenerator(target,
|
|
|
frameworkArgs, false);
|
|
|
}
|
|
|
else
|
|
|
@@ -484,7 +491,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|
|
// The shared library uses the LIBRARY properties.
|
|
|
if (!libraryArgs.GetDestination().empty())
|
|
|
{
|
|
|
- libraryGenerator = CreateInstallTargetGenerator(target,
|
|
|
+ libraryGenerator = CreateInstallTargetGenerator(target,
|
|
|
libraryArgs, false);
|
|
|
libraryGenerator->SetNamelinkMode(namelinkMode);
|
|
|
namelinkOnly =
|
|
|
@@ -507,7 +514,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|
|
// Static libraries use ARCHIVE properties.
|
|
|
if (!archiveArgs.GetDestination().empty())
|
|
|
{
|
|
|
- archiveGenerator = CreateInstallTargetGenerator(target, archiveArgs,
|
|
|
+ archiveGenerator = CreateInstallTargetGenerator(target, archiveArgs,
|
|
|
false);
|
|
|
}
|
|
|
else
|
|
|
@@ -525,7 +532,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|
|
// Modules use LIBRARY properties.
|
|
|
if (!libraryArgs.GetDestination().empty())
|
|
|
{
|
|
|
- libraryGenerator = CreateInstallTargetGenerator(target, libraryArgs,
|
|
|
+ libraryGenerator = CreateInstallTargetGenerator(target, libraryArgs,
|
|
|
false);
|
|
|
libraryGenerator->SetNamelinkMode(namelinkMode);
|
|
|
namelinkOnly =
|
|
|
@@ -548,7 +555,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|
|
// Application bundles use the BUNDLE properties.
|
|
|
if (!bundleArgs.GetDestination().empty())
|
|
|
{
|
|
|
- bundleGenerator = CreateInstallTargetGenerator(target, bundleArgs,
|
|
|
+ bundleGenerator = CreateInstallTargetGenerator(target, bundleArgs,
|
|
|
false);
|
|
|
}
|
|
|
else if(!runtimeArgs.GetDestination().empty())
|
|
|
@@ -580,7 +587,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|
|
// Executables use the RUNTIME properties.
|
|
|
if (!runtimeArgs.GetDestination().empty())
|
|
|
{
|
|
|
- runtimeGenerator = CreateInstallTargetGenerator(target,
|
|
|
+ runtimeGenerator = CreateInstallTargetGenerator(target,
|
|
|
runtimeArgs, false);
|
|
|
}
|
|
|
else
|
|
|
@@ -600,7 +607,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|
|
target.IsExecutableWithExports())
|
|
|
{
|
|
|
// The import library uses the ARCHIVE properties.
|
|
|
- archiveGenerator = CreateInstallTargetGenerator(target,
|
|
|
+ archiveGenerator = CreateInstallTargetGenerator(target,
|
|
|
archiveArgs, true, true);
|
|
|
}
|
|
|
}
|
|
|
@@ -710,7 +717,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|
|
installsRuntime = installsRuntime || runtimeGenerator != 0;
|
|
|
installsFramework = installsFramework || frameworkGenerator != 0;
|
|
|
installsBundle = installsBundle || bundleGenerator != 0;
|
|
|
- installsPrivateHeader = installsPrivateHeader
|
|
|
+ installsPrivateHeader = installsPrivateHeader
|
|
|
|| privateHeaderGenerator != 0;
|
|
|
installsPublicHeader = installsPublicHeader || publicHeaderGenerator != 0;
|
|
|
installsResource = installsResource || resourceGenerator;
|
|
|
@@ -729,7 +736,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|
|
if(!exports.GetString().empty() && !namelinkOnly)
|
|
|
{
|
|
|
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
|
|
|
- ->AddTargetToExports(exports.GetCString(), &target,
|
|
|
+ ->AddTargetToExports(exports.GetCString(), &target,
|
|
|
archiveGenerator, runtimeGenerator,
|
|
|
libraryGenerator, frameworkGenerator,
|
|
|
bundleGenerator, publicHeaderGenerator);
|
|
|
@@ -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);
|
|
|
@@ -803,7 +810,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
|
|
|
this->SetError(e.str().c_str());
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// Check if there is something to do.
|
|
|
if(files.GetVector().empty())
|
|
|
{
|
|
|
@@ -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);
|