diff options
author | Brad King <brad.king@kitware.com> | 2018-03-12 15:37:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-03-12 15:45:01 (GMT) |
commit | 2deb9b7f3495a9083b8d5341f867fed615da1470 (patch) | |
tree | 2dbffba599be936e428fba19c83f99a78c765037 /Source | |
parent | c5541cf0da1093635fea7da5a40e64e481b5477e (diff) | |
download | CMake-2deb9b7f3495a9083b8d5341f867fed615da1470.zip CMake-2deb9b7f3495a9083b8d5341f867fed615da1470.tar.gz CMake-2deb9b7f3495a9083b8d5341f867fed615da1470.tar.bz2 |
Genex: Fix COMPILE_LANGUAGE in SYSTEM include directories
When evaluating `INTERFACE_SYSTEM_INCLUDE_DIRECTORIES`, or evaluating
`INTERFACE_INCLUDE_DIRECTORIES` on an imported target, thread the
compile language through to the generator expression evaluator so
that it can support `$<COMPILE_LANGUAGE:...>`.
Fixes: #17811
Diffstat (limited to 'Source')
-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 |
5 files changed, 22 insertions, 15 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e9b6daf..2bb01b2 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 1ee8a16..2f6ce33 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 d3f5aac..8f61071 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 08f3c0f..cee540b 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 fbfaa40..7c10110 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))); } } |