From 55e4753bbb60c0da12b09837bac97a46b851ae32 Mon Sep 17 00:00:00 2001 From: Eugene Shalygin Date: Tue, 20 Jul 2021 20:08:17 +0200 Subject: Refactor cmTargetExport removing InterfaceIncludeDirecories Because of this property in the cmTargetExport struct, exporting targets is not uniform: top-level ones have to be dealt with via the cmTargetExport objects, while all linked ones are cmGeneratorTarget objects. Let's pass this additional includedirectories via a special target property making handling exported targets uniform. --- Source/cmExportFileGenerator.cxx | 3 ++- Source/cmInstallCommand.cxx | 5 +++-- Source/cmTarget.cxx | 12 ++++++++++++ Source/cmTarget.h | 3 +++ Source/cmTargetExport.h | 1 - 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index c69d484..2c54077 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -378,7 +378,8 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( cmGeneratorExpression ge; std::string dirs = cmGeneratorExpression::Preprocess( - tei->InterfaceIncludeDirectories, preprocessRule, true); + cmJoin(target->Target->GetInstallIncludeDirectoriesEntries(), ";"), + preprocessRule, true); this->ReplaceInstallPrefix(dirs); std::unique_ptr cge = ge.Parse(dirs); std::string exportDirs = diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 79109b5..687741b 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -36,6 +36,7 @@ #include "cmMessageType.h" #include "cmPolicies.h" #include "cmProperty.h" +#include "cmRange.h" #include "cmRuntimeDependencyArchive.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" @@ -681,8 +682,8 @@ bool HandleTargetsMode(std::vector const& args, te->LibraryGenerator = libraryGenerator.get(); te->RuntimeGenerator = runtimeGenerator.get(); te->ObjectsGenerator = objectGenerator.get(); - te->InterfaceIncludeDirectories = - cmJoin(includesArgs.GetIncludeDirs(), ";"); + target.AddInstallIncludeDirectories( + cmMakeRange(includesArgs.GetIncludeDirs())); te->NamelinkOnly = namelinkOnly; helper.Makefile->GetGlobalGenerator() ->GetExportSets()[exports] diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7622700..70e11a2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -189,6 +189,7 @@ public: std::map> LanguageStandardProperties; std::vector IncludeDirectoriesEntries; std::vector IncludeDirectoriesBacktraces; + std::vector InstallIncludeDirectoriesEntries; std::vector CompileOptionsEntries; std::vector CompileOptionsBacktraces; std::vector CompileFeaturesEntries; @@ -1075,6 +1076,17 @@ std::set const& cmTarget::GetSystemIncludeDirectories() const return this->impl->SystemIncludeDirectories; } +void cmTarget::AddInstallIncludeDirectories(cmStringRange const& incs) +{ + std::copy(incs.begin(), incs.end(), + std::back_inserter(this->impl->InstallIncludeDirectoriesEntries)); +} + +cmStringRange cmTarget::GetInstallIncludeDirectoriesEntries() const +{ + return cmMakeRange(this->impl->InstallIncludeDirectoriesEntries); +} + cmStringRange cmTarget::GetIncludeDirectoriesEntries() const { return cmMakeRange(this->impl->IncludeDirectoriesEntries); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 30d9f5d..29130c7 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -237,6 +237,9 @@ public: void AddSystemIncludeDirectories(std::set const& incs); std::set const& GetSystemIncludeDirectories() const; + void AddInstallIncludeDirectories(cmStringRange const& incs); + cmStringRange GetInstallIncludeDirectoriesEntries() const; + BTs const* GetLanguageStandardProperty( const std::string& propertyName) const; diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h index 1e38d84..19fc931 100644 --- a/Source/cmTargetExport.h +++ b/Source/cmTargetExport.h @@ -29,7 +29,6 @@ public: cmInstallTargetGenerator* FrameworkGenerator; cmInstallTargetGenerator* BundleGenerator; cmInstallFilesGenerator* HeaderGenerator; - std::string InterfaceIncludeDirectories; ///@} bool NamelinkOnly = false; -- cgit v0.12