diff options
author | Brad King <brad.king@kitware.com> | 2018-03-13 13:40:25 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-03-13 13:40:25 -0400 |
commit | a039029e7c4e00f3a64578f94e593f00719bb01c (patch) | |
tree | 37dfb11d5ba36ae10da3de699fb725597420fbc7 /Source | |
parent | a54b56a10bc1d03bd6e56b76f0098fb1835094c9 (diff) | |
parent | 1b5e52fd651ab17b3f9efb8f3e2e069550bf7a66 (diff) | |
download | cmake-a039029e7c4e00f3a64578f94e593f00719bb01c.tar.gz |
Merge branch 'genex-COMPILE_LANGUAGE-system-include' into release-3.11
Merge-request: !1844
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 3 | ||||
-rw-r--r-- | Source/cmExportTryCompileFileGenerator.cxx | 19 | ||||
-rw-r--r-- | Source/cmExportTryCompileFileGenerator.h | 5 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 14 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 9 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmServerProtocol.cxx | 7 |
8 files changed, 40 insertions, 24 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 34c6175514..26e0db9e28 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -580,7 +580,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, if (!targets.empty()) { std::string fname = "/" + std::string(targetName) + "Targets.cmake"; - cmExportTryCompileFileGenerator tcfg(gg, targets, this->Makefile); + cmExportTryCompileFileGenerator tcfg(gg, targets, this->Makefile, + testLangs); tcfg.SetExportFile((this->BinaryDirectory + fname).c_str()); tcfg.SetConfig(tcConfig); diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index 1fb9cf8181..ae8cd37435 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -18,7 +18,8 @@ cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator( cmGlobalGenerator* gg, const std::vector<std::string>& targets, - cmMakefile* mf) + cmMakefile* mf, std::set<std::string> const& langs) + : Languages(langs.begin(), langs.end()) { gg->CreateImportedGenerationObjects(mf, targets, this->Exports); } @@ -36,12 +37,14 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os) ImportPropertyMap properties; + for (std::string const& lang : this->Languages) { #define FIND_TARGETS(PROPERTY) \ - this->FindTargets("INTERFACE_" #PROPERTY, te, emittedDeps); + this->FindTargets("INTERFACE_" #PROPERTY, te, lang, emittedDeps); - CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(FIND_TARGETS) + CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(FIND_TARGETS) #undef FIND_TARGETS + } this->PopulateProperties(te, properties, emittedDeps); @@ -53,7 +56,7 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os) std::string cmExportTryCompileFileGenerator::FindTargets( const std::string& propName, cmGeneratorTarget const* tgt, - std::set<cmGeneratorTarget const*>& emitted) + std::string const& language, std::set<cmGeneratorTarget const*>& emitted) { const char* prop = tgt->GetProperty(propName); if (!prop) { @@ -72,8 +75,9 @@ std::string cmExportTryCompileFileGenerator::FindTargets( cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator()); - std::string result = cge->Evaluate(tgt->GetLocalGenerator(), this->Config, - false, &gDummyHead, tgt, &dagChecker); + std::string result = + cge->Evaluate(tgt->GetLocalGenerator(), this->Config, false, &gDummyHead, + tgt, &dagChecker, language); const std::set<cmGeneratorTarget const*>& allTargets = cge->GetAllTargetsSeen(); @@ -97,7 +101,8 @@ void cmExportTryCompileFileGenerator::PopulateProperties( if (p.find("IMPORTED_LINK_INTERFACE_LIBRARIES") == 0 || p.find("IMPORTED_LINK_DEPENDENT_LIBRARIES") == 0 || p.find("INTERFACE_LINK_LIBRARIES") == 0) { - std::string evalResult = this->FindTargets(p, target, emitted); + std::string evalResult = + this->FindTargets(p, target, std::string(), emitted); std::vector<std::string> depends; cmSystemTools::ExpandListArgument(evalResult, depends); diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h index 70c3857280..ca2987cafe 100644 --- a/Source/cmExportTryCompileFileGenerator.h +++ b/Source/cmExportTryCompileFileGenerator.h @@ -21,7 +21,8 @@ class cmExportTryCompileFileGenerator : public cmExportFileGenerator public: cmExportTryCompileFileGenerator(cmGlobalGenerator* gg, std::vector<std::string> const& targets, - cmMakefile* mf); + cmMakefile* mf, + std::set<std::string> const& langs); /** Set the list of targets to export. */ void SetConfig(const std::string& config) { this->Config = config; } @@ -49,10 +50,12 @@ protected: private: std::string FindTargets(const std::string& prop, const cmGeneratorTarget* tgt, + std::string const& language, std::set<const cmGeneratorTarget*>& emitted); std::vector<cmGeneratorTarget const*> Exports; std::string Config; + std::vector<std::string> Languages; }; #endif diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e9b6dafbcb..2bb01b29e5 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -384,14 +384,15 @@ static void handleSystemIncludesDep( cmLocalGenerator* lg, cmGeneratorTarget const* depTgt, const std::string& config, cmGeneratorTarget const* headTarget, cmGeneratorExpressionDAGChecker* dagChecker, - std::vector<std::string>& result, bool excludeImported) + std::vector<std::string>& result, bool excludeImported, + std::string const& language) { if (const char* dirs = depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")) { cmGeneratorExpression ge; cmSystemTools::ExpandListArgument( ge.Parse(dirs)->Evaluate(lg, config, false, headTarget, depTgt, - dagChecker), + dagChecker, language), result); } if (!depTgt->IsImported() || excludeImported) { @@ -403,7 +404,7 @@ static void handleSystemIncludesDep( cmGeneratorExpression ge; cmSystemTools::ExpandListArgument( ge.Parse(dirs)->Evaluate(lg, config, false, headTarget, depTgt, - dagChecker), + dagChecker, language), result); } } @@ -735,7 +736,8 @@ const char* cmGeneratorTarget::GetLocationForBuild() const } bool cmGeneratorTarget::IsSystemIncludeDirectory( - const std::string& dir, const std::string& config) const + const std::string& dir, const std::string& config, + const std::string& language) const { assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY); std::string config_upper; @@ -758,7 +760,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory( cmGeneratorExpression ge; cmSystemTools::ExpandListArgument( ge.Parse(it)->Evaluate(this->LocalGenerator, config, false, this, - &dagChecker), + &dagChecker, language), result); } @@ -766,7 +768,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory( this->GetLinkImplementationClosure(config); for (cmGeneratorTarget const* dep : deps) { handleSystemIncludesDep(this->LocalGenerator, dep, config, this, - &dagChecker, result, excludeImported); + &dagChecker, result, excludeImported, language); } std::for_each(result.begin(), result.end(), diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 1ee8a16fb3..2f6ce33f16 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -413,7 +413,8 @@ public: const std::string& language) const; bool IsSystemIncludeDirectory(const std::string& dir, - const std::string& config) const; + const std::string& config, + const std::string& language) const; /** Add the target output files to the global generator manifest. */ void ComputeTargetManifest(const std::string& config) const; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d3f5aacb1d..8f61071781 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2035,7 +2035,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, if (emitted.insert(frameworkDir).second) { std::string incpath = this->XCodeEscapePath(frameworkDir); if (emitSystemIncludes && - gtgt->IsSystemIncludeDirectory(frameworkDir, configName)) { + gtgt->IsSystemIncludeDirectory(frameworkDir, configName, + langForPreprocessor)) { sysfdirs.Add(incpath); } else { fdirs.Add(incpath); @@ -2044,7 +2045,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, } else { std::string incpath = this->XCodeEscapePath(include); if (emitSystemIncludes && - gtgt->IsSystemIncludeDirectory(include, configName)) { + gtgt->IsSystemIncludeDirectory(include, configName, + langForPreprocessor)) { sysdirs.Add(incpath); } else { dirs.Add(incpath); @@ -2057,7 +2059,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, if (emitted.insert(fwDir).second) { std::string incpath = this->XCodeEscapePath(fwDir); if (emitSystemIncludes && - gtgt->IsSystemIncludeDirectory(fwDir, configName)) { + gtgt->IsSystemIncludeDirectory(fwDir, configName, + langForPreprocessor)) { sysfdirs.Add(incpath); } else { fdirs.Add(incpath); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 08f3c0f7e8..cee540bdb8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -718,7 +718,7 @@ std::string cmLocalGenerator::GetIncludeFlags( frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); if (emitted.insert(frameworkDir).second) { if (sysFwSearchFlag && target && - target->IsSystemIncludeDirectory(i, config)) { + target->IsSystemIncludeDirectory(i, config, lang)) { includeFlags << sysFwSearchFlag; } else { includeFlags << fwSearchFlag; @@ -731,7 +731,7 @@ std::string cmLocalGenerator::GetIncludeFlags( if (!flagUsed || repeatFlag) { if (sysIncludeFlag && target && - target->IsSystemIncludeDirectory(i, config)) { + target->IsSystemIncludeDirectory(i, config, lang)) { includeFlags << sysIncludeFlag; } else { includeFlags << includeFlag; diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index fbfaa40078..7c10110b1e 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -725,8 +725,9 @@ static Json::Value DumpSourceFilesList( lg->AppendIncludeDirectories(includes, evaluatedIncludes, *file); for (const auto& include : includes) { - fileData.IncludePathList.push_back(std::make_pair( - include, target->IsSystemIncludeDirectory(include, config))); + fileData.IncludePathList.push_back( + std::make_pair(include, target->IsSystemIncludeDirectory( + include, config, fileData.Language))); } } @@ -1005,7 +1006,7 @@ static Json::Value DumpTarget(cmGeneratorTarget* target, lg->GetIncludeDirectories(includePathList, target, lang, config, true); for (std::string const& i : includePathList) { ld.IncludePathList.push_back( - std::make_pair(i, target->IsSystemIncludeDirectory(i, config))); + std::make_pair(i, target->IsSystemIncludeDirectory(i, config, lang))); } } |