in Source/cmInstallCommand.cxx [373:1072]
bool HandleTargetsMode(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
Helper helper(status);
// This is the TARGETS mode.
std::vector<cmTarget*> targets;
struct ArgVectors
{
std::vector<std::string> Archive;
std::vector<std::string> Library;
std::vector<std::string> Runtime;
std::vector<std::string> Object;
std::vector<std::string> Framework;
std::vector<std::string> Bundle;
std::vector<std::string> Includes;
std::vector<std::string> PrivateHeader;
std::vector<std::string> PublicHeader;
std::vector<std::string> Resource;
};
static auto const argHelper =
cmArgumentParser<ArgVectors>{}
.Bind("ARCHIVE"_s, &ArgVectors::Archive)
.Bind("LIBRARY"_s, &ArgVectors::Library)
.Bind("RUNTIME"_s, &ArgVectors::Runtime)
.Bind("OBJECTS"_s, &ArgVectors::Object)
.Bind("FRAMEWORK"_s, &ArgVectors::Framework)
.Bind("BUNDLE"_s, &ArgVectors::Bundle)
.Bind("INCLUDES"_s, &ArgVectors::Includes)
.Bind("PRIVATE_HEADER"_s, &ArgVectors::PrivateHeader)
.Bind("PUBLIC_HEADER"_s, &ArgVectors::PublicHeader)
.Bind("RESOURCE"_s, &ArgVectors::Resource);
std::vector<std::string> genericArgVector;
ArgVectors const argVectors = argHelper.Parse(args, &genericArgVector);
// now parse the generic args (i.e. the ones not specialized on LIBRARY/
// ARCHIVE, RUNTIME etc. (see above)
// These generic args also contain the targets and the export stuff
std::vector<std::string> targetList;
std::string exports;
std::vector<std::string> runtimeDependenciesArgVector;
std::string runtimeDependencySetArg;
std::vector<std::string> unknownArgs;
std::vector<std::string> parsedArgs;
cmInstallCommandArguments genericArgs(helper.DefaultComponentName);
genericArgs.Bind("TARGETS"_s, targetList);
genericArgs.Bind("EXPORT"_s, exports);
genericArgs.Bind("RUNTIME_DEPENDENCIES"_s, runtimeDependenciesArgVector);
genericArgs.Bind("RUNTIME_DEPENDENCY_SET"_s, runtimeDependencySetArg);
genericArgs.Parse(genericArgVector, &unknownArgs, nullptr, &parsedArgs);
bool success = genericArgs.Finalize();
bool withRuntimeDependencies =
std::find(parsedArgs.begin(), parsedArgs.end(), "RUNTIME_DEPENDENCIES") !=
parsedArgs.end();
RuntimeDependenciesArgs runtimeDependenciesArgs =
RuntimeDependenciesArgHelper.Parse(runtimeDependenciesArgVector,
&unknownArgs);
cmInstallCommandArguments archiveArgs(helper.DefaultComponentName);
cmInstallCommandArguments libraryArgs(helper.DefaultComponentName);
cmInstallCommandArguments runtimeArgs(helper.DefaultComponentName);
cmInstallCommandArguments objectArgs(helper.DefaultComponentName);
cmInstallCommandArguments frameworkArgs(helper.DefaultComponentName);
cmInstallCommandArguments bundleArgs(helper.DefaultComponentName);
cmInstallCommandArguments privateHeaderArgs(helper.DefaultComponentName);
cmInstallCommandArguments publicHeaderArgs(helper.DefaultComponentName);
cmInstallCommandArguments resourceArgs(helper.DefaultComponentName);
cmInstallCommandIncludesArgument includesArgs;
// now parse the args for specific parts of the target (e.g. LIBRARY,
// RUNTIME, ARCHIVE etc.
archiveArgs.Parse(argVectors.Archive, &unknownArgs);
libraryArgs.Parse(argVectors.Library, &unknownArgs);
runtimeArgs.Parse(argVectors.Runtime, &unknownArgs);
objectArgs.Parse(argVectors.Object, &unknownArgs);
frameworkArgs.Parse(argVectors.Framework, &unknownArgs);
bundleArgs.Parse(argVectors.Bundle, &unknownArgs);
privateHeaderArgs.Parse(argVectors.PrivateHeader, &unknownArgs);
publicHeaderArgs.Parse(argVectors.PublicHeader, &unknownArgs);
resourceArgs.Parse(argVectors.Resource, &unknownArgs);
includesArgs.Parse(&argVectors.Includes, &unknownArgs);
if (!unknownArgs.empty()) {
// Unknown argument.
status.SetError(
cmStrCat("TARGETS given unknown argument \"", unknownArgs[0], "\"."));
return false;
}
// apply generic args
archiveArgs.SetGenericArguments(&genericArgs);
libraryArgs.SetGenericArguments(&genericArgs);
runtimeArgs.SetGenericArguments(&genericArgs);
objectArgs.SetGenericArguments(&genericArgs);
frameworkArgs.SetGenericArguments(&genericArgs);
bundleArgs.SetGenericArguments(&genericArgs);
privateHeaderArgs.SetGenericArguments(&genericArgs);
publicHeaderArgs.SetGenericArguments(&genericArgs);
resourceArgs.SetGenericArguments(&genericArgs);
success = success && archiveArgs.Finalize();
success = success && libraryArgs.Finalize();
success = success && runtimeArgs.Finalize();
success = success && objectArgs.Finalize();
success = success && frameworkArgs.Finalize();
success = success && bundleArgs.Finalize();
success = success && privateHeaderArgs.Finalize();
success = success && publicHeaderArgs.Finalize();
success = success && resourceArgs.Finalize();
if (!success) {
return false;
}
// Enforce argument rules too complex to specify for the
// general-purpose parser.
if (archiveArgs.GetNamelinkOnly() || runtimeArgs.GetNamelinkOnly() ||
objectArgs.GetNamelinkOnly() || frameworkArgs.GetNamelinkOnly() ||
bundleArgs.GetNamelinkOnly() || privateHeaderArgs.GetNamelinkOnly() ||
publicHeaderArgs.GetNamelinkOnly() || resourceArgs.GetNamelinkOnly()) {
status.SetError(
"TARGETS given NAMELINK_ONLY option not in LIBRARY group. "
"The NAMELINK_ONLY option may be specified only following LIBRARY.");
return false;
}
if (archiveArgs.GetNamelinkSkip() || runtimeArgs.GetNamelinkSkip() ||
objectArgs.GetNamelinkSkip() || frameworkArgs.GetNamelinkSkip() ||
bundleArgs.GetNamelinkSkip() || privateHeaderArgs.GetNamelinkSkip() ||
publicHeaderArgs.GetNamelinkSkip() || resourceArgs.GetNamelinkSkip()) {
status.SetError(
"TARGETS given NAMELINK_SKIP option not in LIBRARY group. "
"The NAMELINK_SKIP option may be specified only following LIBRARY.");
return false;
}
if (archiveArgs.HasNamelinkComponent() ||
runtimeArgs.HasNamelinkComponent() ||
objectArgs.HasNamelinkComponent() ||
frameworkArgs.HasNamelinkComponent() ||
bundleArgs.HasNamelinkComponent() ||
privateHeaderArgs.HasNamelinkComponent() ||
publicHeaderArgs.HasNamelinkComponent() ||
resourceArgs.HasNamelinkComponent()) {
status.SetError(
"TARGETS given NAMELINK_COMPONENT option not in LIBRARY group. "
"The NAMELINK_COMPONENT option may be specified only following "
"LIBRARY.");
return false;
}
if (libraryArgs.GetNamelinkOnly() && libraryArgs.GetNamelinkSkip()) {
status.SetError("TARGETS given NAMELINK_ONLY and NAMELINK_SKIP. "
"At most one of these two options may be specified.");
return false;
}
if (!genericArgs.GetType().empty() || !archiveArgs.GetType().empty() ||
!libraryArgs.GetType().empty() || !runtimeArgs.GetType().empty() ||
!objectArgs.GetType().empty() || !frameworkArgs.GetType().empty() ||
!bundleArgs.GetType().empty() || !privateHeaderArgs.GetType().empty() ||
!publicHeaderArgs.GetType().empty() || !resourceArgs.GetType().empty()) {
status.SetError(
"TARGETS given TYPE option. The TYPE option may only be specified in "
" install(FILES) and install(DIRECTORIES).");
return false;
}
cmInstallRuntimeDependencySet* runtimeDependencySet = nullptr;
if (withRuntimeDependencies) {
if (!runtimeDependencySetArg.empty()) {
status.SetError("TARGETS cannot have both RUNTIME_DEPENDENCIES and "
"RUNTIME_DEPENDENCY_SET.");
return false;
}
auto system = helper.Makefile->GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME");
if (!cmRuntimeDependencyArchive::PlatformSupportsRuntimeDependencies(
system)) {
status.SetError(
cmStrCat("TARGETS RUNTIME_DEPENDENCIES is not supported on system \"",
system, '"'));
return false;
}
if (helper.Makefile->IsOn("CMAKE_CROSSCOMPILING")) {
status.SetError("TARGETS RUNTIME_DEPENDENCIES is not supported "
"when cross-compiling.");
return false;
}
if (helper.Makefile->GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME") ==
"Darwin" &&
frameworkArgs.GetDestination().empty()) {
status.SetError(
"TARGETS RUNTIME_DEPENDENCIES given no FRAMEWORK DESTINATION");
return false;
}
runtimeDependencySet = helper.Makefile->GetGlobalGenerator()
->CreateAnonymousRuntimeDependencySet();
} else if (!runtimeDependencySetArg.empty()) {
auto system = helper.Makefile->GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME");
if (!cmRuntimeDependencyArchive::PlatformSupportsRuntimeDependencies(
system)) {
status.SetError(cmStrCat(
"TARGETS RUNTIME_DEPENDENCY_SET is not supported on system \"", system,
'"'));
return false;
}
runtimeDependencySet =
helper.Makefile->GetGlobalGenerator()->GetNamedRuntimeDependencySet(
runtimeDependencySetArg);
}
// Select the mode for installing symlinks to versioned shared libraries.
cmInstallTargetGenerator::NamelinkModeType namelinkMode =
cmInstallTargetGenerator::NamelinkModeNone;
if (libraryArgs.GetNamelinkOnly()) {
namelinkMode = cmInstallTargetGenerator::NamelinkModeOnly;
} else if (libraryArgs.GetNamelinkSkip()) {
namelinkMode = cmInstallTargetGenerator::NamelinkModeSkip;
}
// Check if there is something to do.
if (targetList.empty()) {
return true;
}
for (std::string const& tgt : targetList) {
if (helper.Makefile->IsAlias(tgt)) {
status.SetError(
cmStrCat("TARGETS given target \"", tgt, "\" which is an alias."));
return false;
}
// Lookup this target in the current directory.
cmTarget* target = helper.Makefile->FindLocalNonAliasTarget(tgt);
if (!target) {
// If no local target has been found, find it in the global scope.
cmTarget* const global_target =
helper.Makefile->GetGlobalGenerator()->FindTarget(tgt, true);
if (global_target && !global_target->IsImported()) {
target = global_target;
}
}
if (target) {
// Found the target. Check its type.
if (target->GetType() != cmStateEnums::EXECUTABLE &&
target->GetType() != cmStateEnums::STATIC_LIBRARY &&
target->GetType() != cmStateEnums::SHARED_LIBRARY &&
target->GetType() != cmStateEnums::MODULE_LIBRARY &&
target->GetType() != cmStateEnums::OBJECT_LIBRARY &&
target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
status.SetError(
cmStrCat("TARGETS given target \"", tgt,
"\" which is not an executable, library, or module."));
return false;
}
// Store the target in the list to be installed.
targets.push_back(target);
} else {
// Did not find the target.
status.SetError(
cmStrCat("TARGETS given target \"", tgt, "\" which does not exist."));
return false;
}
}
// Keep track of whether we will be performing an installation of
// any files of the given type.
bool installsArchive = false;
bool installsLibrary = false;
bool installsNamelink = false;
bool installsRuntime = false;
bool installsObject = false;
bool installsFramework = false;
bool installsBundle = false;
bool installsPrivateHeader = false;
bool installsPublicHeader = false;
bool installsResource = false;
// Generate install script code to install the given targets.
for (cmTarget* ti : targets) {
// Handle each target type.
cmTarget& target = *ti;
std::unique_ptr<cmInstallTargetGenerator> archiveGenerator;
std::unique_ptr<cmInstallTargetGenerator> libraryGenerator;
std::unique_ptr<cmInstallTargetGenerator> namelinkGenerator;
std::unique_ptr<cmInstallTargetGenerator> runtimeGenerator;
std::unique_ptr<cmInstallTargetGenerator> objectGenerator;
std::unique_ptr<cmInstallTargetGenerator> frameworkGenerator;
std::unique_ptr<cmInstallTargetGenerator> bundleGenerator;
std::unique_ptr<cmInstallFilesGenerator> privateHeaderGenerator;
std::unique_ptr<cmInstallFilesGenerator> publicHeaderGenerator;
std::unique_ptr<cmInstallFilesGenerator> resourceGenerator;
// Avoid selecting default destinations for PUBLIC_HEADER and
// PRIVATE_HEADER if any artifacts are specified.
bool artifactsSpecified = false;
// Track whether this is a namelink-only rule.
bool namelinkOnly = false;
auto addTargetExport = [&]() {
// Add this install rule to an export if one was specified.
if (!exports.empty()) {
auto te = cm::make_unique<cmTargetExport>();
te->TargetName = target.GetName();
te->ArchiveGenerator = archiveGenerator.get();
te->BundleGenerator = bundleGenerator.get();
te->FrameworkGenerator = frameworkGenerator.get();
te->HeaderGenerator = publicHeaderGenerator.get();
te->LibraryGenerator = libraryGenerator.get();
te->RuntimeGenerator = runtimeGenerator.get();
te->ObjectsGenerator = objectGenerator.get();
target.AddInstallIncludeDirectories(
cmMakeRange(includesArgs.GetIncludeDirs()));
te->NamelinkOnly = namelinkOnly;
helper.Makefile->GetGlobalGenerator()
->GetExportSets()[exports]
.AddTargetExport(std::move(te));
}
};
switch (target.GetType()) {
case cmStateEnums::SHARED_LIBRARY: {
// Shared libraries are handled differently on DLL and non-DLL
// platforms. All windows platforms are DLL platforms including
// cygwin. Currently no other platform is a DLL platform.
if (target.IsDLLPlatform()) {
// When in namelink only mode skip all libraries on Windows.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
namelinkOnly = true;
addTargetExport();
continue;
}
// This is a DLL platform.
if (!archiveArgs.GetDestination().empty()) {
// The import library uses the ARCHIVE properties.
archiveGenerator = CreateInstallTargetGenerator(
target, archiveArgs, true, helper.Makefile->GetBacktrace());
artifactsSpecified = true;
}
if (!runtimeArgs.GetDestination().empty()) {
// The DLL uses the RUNTIME properties.
runtimeGenerator = CreateInstallTargetGenerator(
target, runtimeArgs, false, helper.Makefile->GetBacktrace());
artifactsSpecified = true;
}
if (!archiveGenerator && !runtimeGenerator) {
archiveGenerator = CreateInstallTargetGenerator(
target, archiveArgs, true, helper.Makefile->GetBacktrace(),
helper.GetArchiveDestination(nullptr));
runtimeGenerator = CreateInstallTargetGenerator(
target, runtimeArgs, false, helper.Makefile->GetBacktrace(),
helper.GetRuntimeDestination(nullptr));
}
if (runtimeDependencySet && runtimeGenerator) {
runtimeDependencySet->AddLibrary(runtimeGenerator.get());
}
} else {
// This is a non-DLL platform.
// If it is marked with FRAMEWORK property use the FRAMEWORK set of
// INSTALL properties. Otherwise, use the LIBRARY properties.
if (target.IsFrameworkOnApple()) {
// When in namelink only mode skip frameworks.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
namelinkOnly = true;
addTargetExport();
continue;
}
// Use the FRAMEWORK properties.
if (!frameworkArgs.GetDestination().empty()) {
frameworkGenerator = CreateInstallTargetGenerator(
target, frameworkArgs, false, helper.Makefile->GetBacktrace());
} else {
status.SetError(
cmStrCat("TARGETS given no FRAMEWORK DESTINATION for shared "
"library FRAMEWORK target \"",
target.GetName(), "\"."));
return false;
}
} else {
// The shared library uses the LIBRARY properties.
if (!libraryArgs.GetDestination().empty()) {
artifactsSpecified = true;
}
if (namelinkMode != cmInstallTargetGenerator::NamelinkModeOnly) {
libraryGenerator = CreateInstallTargetGenerator(
target, libraryArgs, false, helper.Makefile->GetBacktrace(),
helper.GetLibraryDestination(&libraryArgs));
libraryGenerator->SetNamelinkMode(
cmInstallTargetGenerator::NamelinkModeSkip);
}
if (namelinkMode != cmInstallTargetGenerator::NamelinkModeSkip) {
namelinkGenerator = CreateInstallTargetGenerator(
target, libraryArgs, false, helper.Makefile->GetBacktrace(),
helper.GetLibraryDestination(&libraryArgs), false, true);
namelinkGenerator->SetNamelinkMode(
cmInstallTargetGenerator::NamelinkModeOnly);
}
namelinkOnly =
(namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly);
}
if (runtimeDependencySet && libraryGenerator) {
runtimeDependencySet->AddLibrary(libraryGenerator.get());
}
}
} break;
case cmStateEnums::STATIC_LIBRARY: {
// If it is marked with FRAMEWORK property use the FRAMEWORK set of
// INSTALL properties. Otherwise, use the LIBRARY properties.
if (target.IsFrameworkOnApple()) {
// When in namelink only mode skip frameworks.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
namelinkOnly = true;
addTargetExport();
continue;
}
// Use the FRAMEWORK properties.
if (!frameworkArgs.GetDestination().empty()) {
frameworkGenerator = CreateInstallTargetGenerator(
target, frameworkArgs, false, helper.Makefile->GetBacktrace());
} else {
status.SetError(
cmStrCat("TARGETS given no FRAMEWORK DESTINATION for static "
"library FRAMEWORK target \"",
target.GetName(), "\"."));
return false;
}
} else {
// Static libraries use ARCHIVE properties.
if (!archiveArgs.GetDestination().empty()) {
artifactsSpecified = true;
}
archiveGenerator = CreateInstallTargetGenerator(
target, archiveArgs, false, helper.Makefile->GetBacktrace(),
helper.GetArchiveDestination(&archiveArgs));
}
} break;
case cmStateEnums::MODULE_LIBRARY: {
// Modules use LIBRARY properties.
if (!libraryArgs.GetDestination().empty()) {
libraryGenerator = CreateInstallTargetGenerator(
target, libraryArgs, false, helper.Makefile->GetBacktrace());
libraryGenerator->SetNamelinkMode(namelinkMode);
namelinkOnly =
(namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly);
if (runtimeDependencySet) {
runtimeDependencySet->AddModule(libraryGenerator.get());
}
} else {
status.SetError(
cmStrCat("TARGETS given no LIBRARY DESTINATION for module "
"target \"",
target.GetName(), "\"."));
return false;
}
} break;
case cmStateEnums::OBJECT_LIBRARY: {
// Objects use OBJECT properties.
if (!objectArgs.GetDestination().empty()) {
// Verify that we know where the objects are to install them.
std::string reason;
if (!helper.Makefile->GetGlobalGenerator()
->HasKnownObjectFileLocation(&reason)) {
status.SetError(
cmStrCat("TARGETS given OBJECT library \"", target.GetName(),
"\" whose objects may not be installed", reason, "."));
return false;
}
objectGenerator = CreateInstallTargetGenerator(
target, objectArgs, false, helper.Makefile->GetBacktrace());
} else {
// Installing an OBJECT library without a destination transforms
// it to an INTERFACE library. It installs no files but can be
// exported.
}
} break;
case cmStateEnums::EXECUTABLE: {
if (target.IsAppBundleOnApple()) {
// Application bundles use the BUNDLE properties.
if (!bundleArgs.GetDestination().empty()) {
bundleGenerator = CreateInstallTargetGenerator(
target, bundleArgs, false, helper.Makefile->GetBacktrace());
} else if (!runtimeArgs.GetDestination().empty()) {
bool failure = false;
if (helper.CheckCMP0006(failure)) {
// For CMake 2.4 compatibility fallback to the RUNTIME
// properties.
bundleGenerator = CreateInstallTargetGenerator(
target, runtimeArgs, false, helper.Makefile->GetBacktrace());
} else if (failure) {
return false;
}
}
if (!bundleGenerator) {
status.SetError(cmStrCat("TARGETS given no BUNDLE DESTINATION for "
"MACOSX_BUNDLE executable target \"",
target.GetName(), "\"."));
return false;
}
if (runtimeDependencySet) {
if (!AddBundleExecutable(helper, runtimeDependencySet,
bundleGenerator.get())) {
return false;
}
}
} else {
// Executables use the RUNTIME properties.
if (!runtimeArgs.GetDestination().empty()) {
artifactsSpecified = true;
}
runtimeGenerator = CreateInstallTargetGenerator(
target, runtimeArgs, false, helper.Makefile->GetBacktrace(),
helper.GetRuntimeDestination(&runtimeArgs));
if (runtimeDependencySet) {
runtimeDependencySet->AddExecutable(runtimeGenerator.get());
}
}
// On DLL platforms an executable may also have an import
// library. Install it to the archive destination if it
// exists.
if ((target.IsDLLPlatform() || target.IsAIX()) &&
!archiveArgs.GetDestination().empty() &&
target.IsExecutableWithExports()) {
// The import library uses the ARCHIVE properties.
artifactsSpecified = true;
archiveGenerator = CreateInstallTargetGenerator(
target, archiveArgs, true, helper.Makefile->GetBacktrace(), true);
}
} break;
case cmStateEnums::INTERFACE_LIBRARY:
// Nothing to do. An INTERFACE_LIBRARY can be installed, but the
// only effect of that is to make it exportable. It installs no
// other files itself.
default:
// This should never happen due to the above type check.
// Ignore the case.
break;
}
// These well-known sets of files are installed *automatically* for
// FRAMEWORK SHARED library targets on the Mac as part of installing the
// FRAMEWORK. For other target types or on other platforms, they are not
// installed automatically and so we need to create install files
// generators for them.
bool createInstallGeneratorsForTargetFileSets = true;
if (target.IsFrameworkOnApple()) {
createInstallGeneratorsForTargetFileSets = false;
}
if (createInstallGeneratorsForTargetFileSets && !namelinkOnly) {
cmValue files = target.GetProperty("PRIVATE_HEADER");
if (cmNonempty(files)) {
std::vector<std::string> relFiles = cmExpandedList(*files);
std::vector<std::string> absFiles;
if (!helper.MakeFilesFullPath("PRIVATE_HEADER", relFiles, absFiles)) {
return false;
}
// Create the files install generator.
if (!artifactsSpecified ||
!privateHeaderArgs.GetDestination().empty()) {
privateHeaderGenerator = CreateInstallFilesGenerator(
helper.Makefile, absFiles, privateHeaderArgs, false,
helper.GetIncludeDestination(&privateHeaderArgs));
} else {
std::ostringstream e;
e << "INSTALL TARGETS - target " << target.GetName() << " has "
<< "PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION.";
cmSystemTools::Message(e.str(), "Warning");
}
}
files = target.GetProperty("PUBLIC_HEADER");
if (cmNonempty(files)) {
std::vector<std::string> relFiles = cmExpandedList(*files);
std::vector<std::string> absFiles;
if (!helper.MakeFilesFullPath("PUBLIC_HEADER", relFiles, absFiles)) {
return false;
}
// Create the files install generator.
if (!artifactsSpecified ||
!publicHeaderArgs.GetDestination().empty()) {
publicHeaderGenerator = CreateInstallFilesGenerator(
helper.Makefile, absFiles, publicHeaderArgs, false,
helper.GetIncludeDestination(&publicHeaderArgs));
} else {
std::ostringstream e;
e << "INSTALL TARGETS - target " << target.GetName() << " has "
<< "PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.";
cmSystemTools::Message(e.str(), "Warning");
}
}
files = target.GetProperty("RESOURCE");
if (cmNonempty(files)) {
std::vector<std::string> relFiles = cmExpandedList(*files);
std::vector<std::string> absFiles;
if (!helper.MakeFilesFullPath("RESOURCE", relFiles, absFiles)) {
return false;
}
// Create the files install generator.
if (!resourceArgs.GetDestination().empty()) {
resourceGenerator = CreateInstallFilesGenerator(
helper.Makefile, absFiles, resourceArgs, false);
} else if (!target.IsAppBundleOnApple()) {
cmSystemTools::Message(
cmStrCat("INSTALL TARGETS - target ", target.GetName(),
" has RESOURCE files but no RESOURCE DESTINATION."),
"Warning");
}
}
}
// Add this install rule to an export if one was specified.
addTargetExport();
// Keep track of whether we're installing anything in each category
installsArchive = installsArchive || archiveGenerator;
installsLibrary = installsLibrary || libraryGenerator;
installsNamelink = installsNamelink || namelinkGenerator;
installsRuntime = installsRuntime || runtimeGenerator;
installsObject = installsObject || objectGenerator;
installsFramework = installsFramework || frameworkGenerator;
installsBundle = installsBundle || bundleGenerator;
installsPrivateHeader = installsPrivateHeader || privateHeaderGenerator;
installsPublicHeader = installsPublicHeader || publicHeaderGenerator;
installsResource = installsResource || resourceGenerator;
helper.Makefile->AddInstallGenerator(std::move(archiveGenerator));
helper.Makefile->AddInstallGenerator(std::move(libraryGenerator));
helper.Makefile->AddInstallGenerator(std::move(namelinkGenerator));
helper.Makefile->AddInstallGenerator(std::move(runtimeGenerator));
helper.Makefile->AddInstallGenerator(std::move(objectGenerator));
helper.Makefile->AddInstallGenerator(std::move(frameworkGenerator));
helper.Makefile->AddInstallGenerator(std::move(bundleGenerator));
helper.Makefile->AddInstallGenerator(std::move(privateHeaderGenerator));
helper.Makefile->AddInstallGenerator(std::move(publicHeaderGenerator));
helper.Makefile->AddInstallGenerator(std::move(resourceGenerator));
}
if (withRuntimeDependencies && !runtimeDependencySet->Empty()) {
AddInstallRuntimeDependenciesGenerator(
helper, runtimeDependencySet, runtimeArgs, libraryArgs, frameworkArgs,
std::move(runtimeDependenciesArgs), installsRuntime, installsLibrary,
installsFramework);
}
// Tell the global generator about any installation component names
// specified
if (installsArchive) {
helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
archiveArgs.GetComponent());
}
if (installsLibrary) {
helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
libraryArgs.GetComponent());
}
if (installsNamelink) {
helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
libraryArgs.GetNamelinkComponent());
}
if (installsRuntime) {
helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
runtimeArgs.GetComponent());
}
if (installsObject) {
helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
objectArgs.GetComponent());
}
if (installsFramework) {
helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
frameworkArgs.GetComponent());
}
if (installsBundle) {
helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
bundleArgs.GetComponent());
}
if (installsPrivateHeader) {
helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
privateHeaderArgs.GetComponent());
}
if (installsPublicHeader) {
helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
publicHeaderArgs.GetComponent());
}
if (installsResource) {
helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
resourceArgs.GetComponent());
}
return true;
}