diff options
author | Craig Scott <craig.scott@crascit.com> | 2020-10-12 23:19:22 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-10-12 23:19:33 (GMT) |
commit | 343c8fe8abb156cc00d2b9c27a6674f0fc41cfc2 (patch) | |
tree | 0c907ba6bedd5922b3e4b7643122834a625ffb17 /Source | |
parent | 0673ad599e2e4e22546449184787c6c1a04b8ae5 (diff) | |
parent | 64690f6df043b65b083c258b2c53910508336469 (diff) | |
download | CMake-343c8fe8abb156cc00d2b9c27a6674f0fc41cfc2.zip CMake-343c8fe8abb156cc00d2b9c27a6674f0fc41cfc2.tar.gz CMake-343c8fe8abb156cc00d2b9c27a6674f0fc41cfc2.tar.bz2 |
Merge topic 'export-namelink-only'
64690f6df0 export: Do not fail generation for namelink-only case
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5352
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmInstallCommand.cxx | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 83609e2..9a5dbef 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -461,6 +461,28 @@ bool HandleTargetsMode(std::vector<std::string> const& args, std::unique_ptr<cmInstallFilesGenerator> publicHeaderGenerator; std::unique_ptr<cmInstallFilesGenerator> resourceGenerator; + auto addTargetExport = [&]() { + // Add this install rule to an export if one was specified. + // (If this is a namelink-only rule no export file will be generated.) + 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(); + te->InterfaceIncludeDirectories = + cmJoin(includesArgs.GetIncludeDirs(), ";"); + + helper.Makefile->GetGlobalGenerator() + ->GetExportSets()[exports] + .AddTargetExport(std::move(te)); + } + }; + // Avoid selecting default destinations for PUBLIC_HEADER and // PRIVATE_HEADER if any artifacts are specified. bool artifactsSpecified = false; @@ -476,6 +498,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, if (target.IsDLLPlatform()) { // When in namelink only mode skip all libraries on Windows. if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) { + addTargetExport(); continue; } @@ -507,6 +530,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, if (target.IsFrameworkOnApple()) { // When in namelink only mode skip frameworks. if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) { + addTargetExport(); continue; } @@ -551,6 +575,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, if (target.IsFrameworkOnApple()) { // When in namelink only mode skip frameworks. if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) { + addTargetExport(); continue; } @@ -744,25 +769,8 @@ bool HandleTargetsMode(std::vector<std::string> const& args, } } - // Add this install rule to an export if one was specified and - // this is not a namelink-only rule. - if (!exports.empty() && !namelinkOnly) { - 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(); - te->InterfaceIncludeDirectories = - cmJoin(includesArgs.GetIncludeDirs(), ";"); - - helper.Makefile->GetGlobalGenerator() - ->GetExportSets()[exports] - .AddTargetExport(std::move(te)); - } + // 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; |