This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via dcc117b9446cfc3d6c8bf191545aac8d1519abca (commit) via 908fc3605b7029126c24b5c5f581758bd00905c6 (commit) via 13c7a16cde47b4c5fc2bf62f9bfc497b123e9c94 (commit) via a6093ed18d323741c48b6c3e72c4b94c05914731 (commit) via 7dcf9cb83c2082168f218be8f21b95b77cc95a86 (commit) via acb9511044a230126289c1e99cfed134c3be3c52 (commit) via c7c59dae82594557dc2fddc4ef881dafeaad076a (commit) via c12222db86859a5a5ce9163a5309bb0da10ec616 (commit) via 1811411fecf3d9769ad7a13f6ecd01c5351df9c4 (commit) via edb0bbd18b5c3dac16ab7d219f787513203529e4 (commit) via 8456f60dbc13b9fbd0490371c871a1e85a72c3a8 (commit) via f4afcd5c6bee7604e031aaab2fa38a9e9ba93900 (commit) via 61fdf326d8e762aaaef22d8ecce443674d5205e6 (commit) via 0965bd9c064a5a595ca1bde01e8dba425ea2b916 (commit) from 28bd7e41b8792365c8730bdbffed825d70e50471 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dcc117b9446cfc3d6c8bf191545aac8d1519abca commit dcc117b9446cfc3d6c8bf191545aac8d1519abca Merge: 908fc36 acb9511 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Sep 24 14:33:13 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Sep 24 10:34:38 2019 -0400 Merge topic 'pch-relative-includes' acb9511044 Precompile headers: Treat headers as relative to current source directory Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3840 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=908fc3605b7029126c24b5c5f581758bd00905c6 commit 908fc3605b7029126c24b5c5f581758bd00905c6 Merge: 13c7a16 7dcf9cb Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Sep 24 14:31:25 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Sep 24 10:33:41 2019 -0400 Merge topic 'add-genex-evaluate-utility' 7dcf9cb83c cmGeneratorExpression: Add cmGeneratorExpression::Evaluate utility c7c59dae82 cmCustomCommandGenerator: Replace generator expression member c12222db86 cmGeneratorExpression: Remove Evaluate overload by parameter re-ordering 1811411fec cmGeneratorExpression: Move quiet flag to cmCompiledGeneratorExpression edb0bbd18b cmGeneratorTarget: Remove unused virtual signature of TargetPropertyEntry Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3852 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13c7a16cde47b4c5fc2bf62f9bfc497b123e9c94 commit 13c7a16cde47b4c5fc2bf62f9bfc497b123e9c94 Merge: a6093ed f4afcd5 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Sep 24 14:30:57 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Sep 24 10:32:43 2019 -0400 Merge topic 'miscellaneous-refactorings' f4afcd5c6b VS: Remove call to ConvertToWindowsExtendedPath with result discarded 61fdf326d8 cmState: Avoid lowering command name twice 0965bd9c06 Generators: Remove function declarations which do not have a definition Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3847 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6093ed18d323741c48b6c3e72c4b94c05914731 commit a6093ed18d323741c48b6c3e72c4b94c05914731 Merge: 28bd7e4 8456f60 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Sep 24 14:30:46 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Sep 24 10:31:27 2019 -0400 Merge topic 'update-cached-is-generated-property' 8456f60dbc cmSourceFile: Remove non-const GetProperties accessor Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3848 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7dcf9cb83c2082168f218be8f21b95b77cc95a86 commit 7dcf9cb83c2082168f218be8f21b95b77cc95a86 Author: Daniel Eiband <daniel.eib...@brainlab.com> AuthorDate: Sun Sep 22 09:53:44 2019 +0200 Commit: Daniel Eiband <daniel.eib...@brainlab.com> CommitDate: Mon Sep 23 21:19:15 2019 +0200 cmGeneratorExpression: Add cmGeneratorExpression::Evaluate utility cmGeneratorExpression::Evaluate is a shortcut when only the evaluated string is needed or an instance of cmCompiledGeneratorExpression cannot be cached. Fixes: #19686 diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 1bc3452..1f31069 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -36,6 +36,31 @@ std::unique_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse( return this->Parse(std::string(input ? input : "")); } +std::string cmGeneratorExpression::Evaluate( + std::string input, cmLocalGenerator* lg, const std::string& config, + cmGeneratorTarget const* headTarget, + cmGeneratorExpressionDAGChecker* dagChecker, + cmGeneratorTarget const* currentTarget, std::string const& language) +{ + if (Find(input) != std::string::npos) { + cmCompiledGeneratorExpression cge(cmListFileBacktrace(), std::move(input)); + return cge.Evaluate(lg, config, headTarget, dagChecker, currentTarget, + language); + } + return input; +} + +std::string cmGeneratorExpression::Evaluate( + const char* input, cmLocalGenerator* lg, const std::string& config, + cmGeneratorTarget const* headTarget, + cmGeneratorExpressionDAGChecker* dagChecker, + cmGeneratorTarget const* currentTarget, std::string const& language) +{ + return input ? Evaluate(std::string(input), lg, config, headTarget, + dagChecker, currentTarget, language) + : ""; +} + const std::string& cmCompiledGeneratorExpression::Evaluate( cmLocalGenerator* lg, const std::string& config, const cmGeneratorTarget* headTarget, diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 322bf5c..de5c705 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -45,6 +45,19 @@ public: std::unique_ptr<cmCompiledGeneratorExpression> Parse( const char* input) const; + static std::string Evaluate( + std::string input, cmLocalGenerator* lg, const std::string& config, + cmGeneratorTarget const* headTarget = nullptr, + cmGeneratorExpressionDAGChecker* dagChecker = nullptr, + cmGeneratorTarget const* currentTarget = nullptr, + std::string const& language = std::string()); + static std::string Evaluate( + const char* input, cmLocalGenerator* lg, const std::string& config, + cmGeneratorTarget const* headTarget = nullptr, + cmGeneratorExpressionDAGChecker* dagChecker = nullptr, + cmGeneratorTarget const* currentTarget = nullptr, + std::string const& language = std::string()); + enum PreprocessContext { StripAllGeneratorExpressions, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b66d9d5..350d28f 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -487,9 +487,8 @@ std::string cmGeneratorTarget::GetOutputName( } // Now evaluate genex and update the previously-prepared map entry. - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outName); - i->second = cge->Evaluate(this->LocalGenerator, config); + i->second = + cmGeneratorExpression::Evaluate(outName, this->LocalGenerator, config); } else if (i->second.empty()) { // An empty map entry indicates we have been called recursively // from the above block. @@ -709,9 +708,8 @@ void handleSystemIncludesDep(cmLocalGenerator* lg, { if (const char* dirs = depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")) { - cmGeneratorExpression ge; - cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, dagChecker, - depTgt, language), + cmExpandList(cmGeneratorExpression::Evaluate(dirs, lg, config, headTarget, + dagChecker, depTgt, language), result); } if (!depTgt->IsImported() || excludeImported) { @@ -720,9 +718,8 @@ void handleSystemIncludesDep(cmLocalGenerator* lg, if (const char* dirs = depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) { - cmGeneratorExpression ge; - cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, dagChecker, - depTgt, language), + cmExpandList(cmGeneratorExpression::Evaluate(dirs, lg, config, headTarget, + dagChecker, depTgt, language), result); } } @@ -1092,9 +1089,9 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory( std::vector<std::string> result; for (std::string const& it : this->Target->GetSystemIncludeDirectories()) { - cmGeneratorExpression ge; - cmExpandList(ge.Parse(it)->Evaluate(this->LocalGenerator, config, this, - &dagChecker, nullptr, language), + cmExpandList(cmGeneratorExpression::Evaluate(it, this->LocalGenerator, + config, this, &dagChecker, + nullptr, language), result); } @@ -2515,13 +2512,12 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result, if (!prop) { return; } - cmGeneratorExpression ge; cmGeneratorExpressionDAGChecker dagChecker(this, "AUTOUIC_OPTIONS", nullptr, nullptr); - cmExpandList( - ge.Parse(prop)->Evaluate(this->LocalGenerator, config, this, &dagChecker), - result); + cmExpandList(cmGeneratorExpression::Evaluate(prop, this->LocalGenerator, + config, this, &dagChecker), + result); } void processILibs(const std::string& config, @@ -5552,18 +5548,15 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config, // Select an output directory. if (const char* config_outdir = this->GetProperty(configProp)) { // Use the user-specified per-configuration output directory. - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(config_outdir); - out = cge->Evaluate(this->LocalGenerator, config); + out = cmGeneratorExpression::Evaluate(config_outdir, this->LocalGenerator, + config); // Skip per-configuration subdirectory. conf.clear(); } else if (const char* outdir = this->GetProperty(propertyName)) { // Use the user-specified output directory. - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outdir); - out = cge->Evaluate(this->LocalGenerator, config); + out = + cmGeneratorExpression::Evaluate(outdir, this->LocalGenerator, config); // Skip per-configuration subdirectory if the value contained a // generator expression. @@ -5631,18 +5624,15 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind, // Select an output directory. if (const char* config_outdir = this->GetProperty(configProp)) { // Use the user-specified per-configuration output directory. - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(config_outdir); - out = cge->Evaluate(this->LocalGenerator, config); + out = cmGeneratorExpression::Evaluate(config_outdir, this->LocalGenerator, + config); // Skip per-configuration subdirectory. conf.clear(); } else if (const char* outdir = this->GetProperty(propertyName)) { // Use the user-specified output directory. - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outdir); - out = cge->Evaluate(this->LocalGenerator, config); + out = + cmGeneratorExpression::Evaluate(outdir, this->LocalGenerator, config); // Skip per-configuration subdirectory if the value contained a // generator expression. @@ -5697,8 +5687,7 @@ bool cmGeneratorTarget::GetRPATH(const std::string& config, return false; } - cmGeneratorExpression ge; - rpath = ge.Parse(value)->Evaluate(this->LocalGenerator, config); + rpath = cmGeneratorExpression::Evaluate(value, this->LocalGenerator, config); return true; } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 92316d3..7faafba 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -663,10 +663,8 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( for (std::string const& i : configs) { const char* propertyValue = target->Target->GetMakefile()->GetDefinition(propertyName); - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(propertyValue); - if (cmIsOn(cge->Evaluate(target->GetLocalGenerator(), i))) { + if (cmIsOn(cmGeneratorExpression::Evaluate( + propertyValue, target->GetLocalGenerator(), i))) { activeConfigs.insert(i); } } diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 255739d..f25d2e2 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -284,11 +284,9 @@ bool cmGlobalVisualStudio8Generator::DeployInhibited( cmGeneratorTarget const& target, const char* config) const { bool rVal = false; - if (const char* propStr = target.GetProperty("VS_NO_SOLUTION_DEPLOY")) { - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(propStr); - std::string prop = cge->Evaluate(target.LocalGenerator, config); - rVal = cmIsOn(prop); + if (const char* prop = target.GetProperty("VS_NO_SOLUTION_DEPLOY")) { + rVal = cmIsOn( + cmGeneratorExpression::Evaluate(prop, target.LocalGenerator, config)); } return rVal; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 643cc99..2c3d3ad 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2381,10 +2381,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string attribute = prop.substr(16); this->FilterConfigurationAttribute(configName, attribute); if (!attribute.empty()) { - cmGeneratorExpression ge; - std::string processed = - ge.Parse(gtgt->GetProperty(prop)) - ->Evaluate(this->CurrentLocalGenerator, configName); + std::string processed = cmGeneratorExpression::Evaluate( + gtgt->GetProperty(prop), this->CurrentLocalGenerator, configName); buildSettings->AddAttribute(attribute, this->CreateString(processed)); } @@ -3118,10 +3116,9 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( std::string attribute = var.substr(22); this->FilterConfigurationAttribute(config.first, attribute); if (!attribute.empty()) { - cmGeneratorExpression ge; - std::string processed = - ge.Parse(this->CurrentMakefile->GetDefinition(var)) - ->Evaluate(this->CurrentLocalGenerator, config.first); + std::string processed = cmGeneratorExpression::Evaluate( + this->CurrentMakefile->GetDefinition(var), + this->CurrentLocalGenerator, config.first); buildSettingsForCfg->AddAttribute(attribute, this->CreateString(processed)); } diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index 1d8210c..259c7f7 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -9,8 +9,6 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include <memory> - cmInstallDirectoryGenerator::cmInstallDirectoryGenerator( std::vector<std::string> const& dirs, const char* dest, const char* file_permissions, const char* dir_permissions, @@ -64,10 +62,9 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig( std::ostream& os, const std::string& config, Indent indent) { std::vector<std::string> dirs; - cmGeneratorExpression ge; for (std::string const& d : this->Directories) { - std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(d); - cmExpandList(cge->Evaluate(this->LocalGenerator, config), dirs); + cmExpandList( + cmGeneratorExpression::Evaluate(d, this->LocalGenerator, config), dirs); } // Make sure all dirs have absolute paths. @@ -97,6 +94,6 @@ void cmInstallDirectoryGenerator::AddDirectoryInstallRule( std::string cmInstallDirectoryGenerator::GetDestination( std::string const& config) const { - cmGeneratorExpression ge; - return ge.Parse(this->Destination)->Evaluate(this->LocalGenerator, config); + return cmGeneratorExpression::Evaluate(this->Destination, + this->LocalGenerator, config); } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index c4048d4..f5b69a5 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -6,8 +6,6 @@ #include "cmInstallType.h" #include "cmStringAlgorithms.h" -#include <memory> - class cmLocalGenerator; cmInstallFilesGenerator::cmInstallFilesGenerator( @@ -51,8 +49,8 @@ bool cmInstallFilesGenerator::Compute(cmLocalGenerator* lg) std::string cmInstallFilesGenerator::GetDestination( std::string const& config) const { - cmGeneratorExpression ge; - return ge.Parse(this->Destination)->Evaluate(this->LocalGenerator, config); + return cmGeneratorExpression::Evaluate(this->Destination, + this->LocalGenerator, config); } void cmInstallFilesGenerator::AddFilesInstallRule( @@ -82,10 +80,9 @@ void cmInstallFilesGenerator::GenerateScriptForConfig( std::ostream& os, const std::string& config, Indent indent) { std::vector<std::string> files; - cmGeneratorExpression ge; for (std::string const& f : this->Files) { - std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(f); - cmExpandList(cge->Evaluate(this->LocalGenerator, config), files); + cmExpandList( + cmGeneratorExpression::Evaluate(f, this->LocalGenerator, config), files); } this->AddFilesInstallRule(os, config, indent, files); } diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index b7b7817..ea29455 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmInstallScriptGenerator.h" -#include <memory> #include <ostream> #include <vector> @@ -79,11 +78,9 @@ void cmInstallScriptGenerator::GenerateScriptForConfig( std::ostream& os, const std::string& config, Indent indent) { if (this->AllowGenex) { - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(this->Script); this->AddScriptInstallRule(os, indent, - cge->Evaluate(this->LocalGenerator, config)); + cmGeneratorExpression::Evaluate( + this->Script, this->LocalGenerator, config)); } else { this->AddScriptInstallRule(os, indent, this->Script); } diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 90b0e1d..0cd04cc 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -4,7 +4,6 @@ #include <cassert> #include <map> -#include <memory> #include <set> #include <sstream> #include <utility> @@ -375,9 +374,8 @@ void cmInstallTargetGenerator::GetInstallObjectNames( std::string cmInstallTargetGenerator::GetDestination( std::string const& config) const { - cmGeneratorExpression ge; - return ge.Parse(this->Destination) - ->Evaluate(this->Target->GetLocalGenerator(), config); + return cmGeneratorExpression::Evaluate( + this->Destination, this->Target->GetLocalGenerator(), config); } std::string cmInstallTargetGenerator::GetInstallFilename( diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx index 52e28d3..79180cb 100644 --- a/Source/cmJsonObjects.cxx +++ b/Source/cmJsonObjects.cxx @@ -32,7 +32,6 @@ #include <functional> #include <limits> #include <map> -#include <memory> #include <set> #include <string> #include <unordered_map> @@ -357,10 +356,8 @@ static Json::Value DumpCTestInfo(cmLocalGenerator* lg, cmTest* testInfo, } // Remove any config specific variables from the output. - cmGeneratorExpression ge; - auto cge = ge.Parse(command); - const std::string& processed = cge->Evaluate(lg, config); - result[kCTEST_COMMAND] = processed; + result[kCTEST_COMMAND] = + cmGeneratorExpression::Evaluate(command, lg, config); // Build up the list of properties that may have been specified Json::Value properties = Json::arrayValue; @@ -369,9 +366,8 @@ static Json::Value DumpCTestInfo(cmLocalGenerator* lg, cmTest* testInfo, entry[kKEY_KEY] = prop.first; // Remove config variables from the value too. - auto cge_value = ge.Parse(prop.second); - const std::string& processed_value = cge_value->Evaluate(lg, config); - entry[kVALUE_KEY] = processed_value; + entry[kVALUE_KEY] = + cmGeneratorExpression::Evaluate(prop.second, lg, config); properties.append(entry); } result[kPROPERTIES_KEY] = properties; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 19962e3..93e074d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -48,7 +48,6 @@ #include <functional> #include <initializer_list> #include <iterator> -#include <memory> #include <sstream> #include <unordered_set> #include <utility> @@ -925,10 +924,8 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags, // to ON if (char const* jmcExprGen = target->GetProperty("VS_JUST_MY_CODE_DEBUGGING")) { - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(jmcExprGen); - std::string isJMCEnabled = cge->Evaluate(this, config); + std::string isJMCEnabled = + cmGeneratorExpression::Evaluate(jmcExprGen, this, config); if (cmIsOn(isJMCEnabled)) { std::vector<std::string> optVec = cmExpandedList(jmc); std::string jmcFlags; @@ -1710,10 +1707,8 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, if (!msvcRuntimeLibraryValue) { msvcRuntimeLibraryValue = msvcRuntimeLibraryDefault; } - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(msvcRuntimeLibraryValue); - std::string const msvcRuntimeLibrary = cge->Evaluate(this, config, target); + std::string const msvcRuntimeLibrary = cmGeneratorExpression::Evaluate( + msvcRuntimeLibraryValue, this, config, target); if (!msvcRuntimeLibrary.empty()) { if (const char* msvcRuntimeLibraryOptions = this->Makefile->GetDefinition( diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 0fe385f..82dc943 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -608,12 +608,10 @@ void cmLocalNinjaGenerator::AdditionalCleanFiles() this->Makefile->GetProperty("ADDITIONAL_CLEAN_FILES")) { std::vector<std::string> cleanFiles; { - cmGeneratorExpression ge; - auto cge = ge.Parse(prop_value); - cmExpandList( - cge->Evaluate(this, - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")), - cleanFiles); + cmExpandList(cmGeneratorExpression::Evaluate( + prop_value, this, + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")), + cleanFiles); } std::string const& binaryDir = this->GetCurrentBinaryDirectory(); cmGlobalNinjaGenerator* gg = this->GetGlobalNinjaGenerator(); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index a7be04e..1d87e93 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1083,12 +1083,10 @@ void cmLocalUnixMakefileGenerator3::AppendDirectoryCleanCommand( // Look for additional files registered for cleaning in this directory. if (const char* prop_value = this->Makefile->GetProperty("ADDITIONAL_CLEAN_FILES")) { - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop_value); - cmExpandList( - cge->Evaluate(this, - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")), - cleanFiles); + cmExpandList(cmGeneratorExpression::Evaluate( + prop_value, this, + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")), + cleanFiles); } if (cleanFiles.empty()) { return; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index fa361bb..d352f8e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -154,11 +154,10 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() auto evaluatedFiles = [this](const char* prop_value) -> std::vector<std::string> { std::vector<std::string> files; - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop_value); - cmExpandList(cge->Evaluate(this->LocalGenerator, this->ConfigName, - this->GeneratorTarget, nullptr, nullptr), - files); + cmExpandList( + cmGeneratorExpression::Evaluate(prop_value, this->LocalGenerator, + this->ConfigName, this->GeneratorTarget), + files); return files; }; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index bee044e..613e7aa 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1317,14 +1317,11 @@ void cmNinjaTargetGenerator::AdditionalCleanFiles() this->GeneratorTarget->GetProperty("ADDITIONAL_CLEAN_FILES")) { cmLocalNinjaGenerator* lg = this->LocalGenerator; std::vector<std::string> cleanFiles; - { - cmGeneratorExpression ge; - auto cge = ge.Parse(prop_value); - cmExpandList(cge->Evaluate( - lg, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"), - this->GeneratorTarget, nullptr, nullptr), - cleanFiles); - } + cmExpandList(cmGeneratorExpression::Evaluate( + prop_value, lg, + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"), + this->GeneratorTarget), + cleanFiles); std::string const& binaryDir = lg->GetCurrentBinaryDirectory(); cmGlobalNinjaGenerator* gg = lg->GetGlobalNinjaGenerator(); for (std::string const& cleanFile : cleanFiles) { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 4b83595..34aac49 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1139,10 +1139,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0) std::string configType; if (const char* vsConfigurationType = this->GeneratorTarget->GetProperty("VS_CONFIGURATION_TYPE")) { - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(vsConfigurationType); - configType = cge->Evaluate(this->LocalGenerator, c); + configType = cmGeneratorExpression::Evaluate(vsConfigurationType, + this->LocalGenerator, c); } else { switch (this->GeneratorTarget->GetType()) { case cmStateEnums::SHARED_LIBRARY: @@ -2447,49 +2445,32 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions( if (ttype <= cmStateEnums::UTILITY) { if (const char* workingDir = this->GeneratorTarget->GetProperty( "VS_DEBUGGER_WORKING_DIRECTORY")) { - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(workingDir); - std::string genWorkingDir = - cge->Evaluate(this->LocalGenerator, config); - + std::string genWorkingDir = cmGeneratorExpression::Evaluate( + workingDir, this->LocalGenerator, config); e1.WritePlatformConfigTag("LocalDebuggerWorkingDirectory", cond, genWorkingDir); } if (const char* environment = this->GeneratorTarget->GetProperty("VS_DEBUGGER_ENVIRONMENT")) { - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(environment); - std::string genEnvironment = - cge->Evaluate(this->LocalGenerator, config); - + std::string genEnvironment = cmGeneratorExpression::Evaluate( + environment, this->LocalGenerator, config); e1.WritePlatformConfigTag("LocalDebuggerEnvironment", cond, genEnvironment); } if (const char* debuggerCommand = this->GeneratorTarget->GetProperty("VS_DEBUGGER_COMMAND")) { - - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(debuggerCommand); - std::string genDebuggerCommand = - cge->Evaluate(this->LocalGenerator, config); - + std::string genDebuggerCommand = cmGeneratorExpression::Evaluate( + debuggerCommand, this->LocalGenerator, config); e1.WritePlatformConfigTag("LocalDebuggerCommand", cond, genDebuggerCommand); } if (const char* commandArguments = this->GeneratorTarget->GetProperty( "VS_DEBUGGER_COMMAND_ARGUMENTS")) { - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(commandArguments); - std::string genCommandArguments = - cge->Evaluate(this->LocalGenerator, config); - + std::string genCommandArguments = cmGeneratorExpression::Evaluate( + commandArguments, this->LocalGenerator, config); e1.WritePlatformConfigTag("LocalDebuggerCommandArguments", cond, genCommandArguments); } @@ -3479,22 +3460,16 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( if (const char* nativeLibDirectoriesExpression = this->GeneratorTarget->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES")) { - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(nativeLibDirectoriesExpression); - std::string nativeLibDirs = - cge->Evaluate(this->LocalGenerator, configName); + std::string nativeLibDirs = cmGeneratorExpression::Evaluate( + nativeLibDirectoriesExpression, this->LocalGenerator, configName); e2.Element("NativeLibDirectories", nativeLibDirs); } if (const char* nativeLibDependenciesExpression = this->GeneratorTarget->GetProperty( "ANDROID_NATIVE_LIB_DEPENDENCIES")) { - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(nativeLibDependenciesExpression); - std::string nativeLibDeps = - cge->Evaluate(this->LocalGenerator, configName); + std::string nativeLibDeps = cmGeneratorExpression::Evaluate( + nativeLibDependenciesExpression, this->LocalGenerator, configName); e2.Element("NativeLibDependencies", nativeLibDeps); } @@ -3505,11 +3480,8 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( if (const char* jarDirectoriesExpression = this->GeneratorTarget->GetProperty("ANDROID_JAR_DIRECTORIES")) { - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(jarDirectoriesExpression); - std::string jarDirectories = - cge->Evaluate(this->LocalGenerator, configName); + std::string jarDirectories = cmGeneratorExpression::Evaluate( + jarDirectoriesExpression, this->LocalGenerator, configName); e2.Element("JarDirectories", jarDirectories); } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=acb9511044a230126289c1e99cfed134c3be3c52 commit acb9511044a230126289c1e99cfed134c3be3c52 Author: Cristian Adam <cristian.a...@gmail.com> AuthorDate: Thu Sep 19 23:56:31 2019 +0200 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Sep 23 11:13:13 2019 -0400 Precompile headers: Treat headers as relative to current source directory Teach `target_precompile_headers` to treat relative paths the same way as `target_sources`. Fixes: #19733 diff --git a/Help/command/target_precompile_headers.rst b/Help/command/target_precompile_headers.rst index 7d36b11..3a32f41 100644 --- a/Help/command/target_precompile_headers.rst +++ b/Help/command/target_precompile_headers.rst @@ -48,17 +48,32 @@ See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-compile-features(7)` manual for information on compile features and a list of supported compilers. +Usage +^^^^^ + .. code-block:: cmake target_precompile_headers(<target> PUBLIC - "project_header.h" + project_header.h PRIVATE + [["other_header.h"]] <unordered_map> ) -Header files will be double quoted if they are not specified with double -quotes or angle brackets. +The list of header files is used to generate a header file named +``cmake_pch.h|xx`` which is used to generate the precompiled header file +(``.pch``, ``.gch``, ``.pchi``) artifact. The ``cmake_pch.h|xx`` header +file will be force included (``-include`` for GCC, ``/FI`` for MSVC) to +all source files, so sources do not need to have ``#include "pch.h"``. + +Header file names specified with angle brackets (e.g. ``<unordered_map>``) or +explicit double quotes (escaped for the :manual:`cmake-language(7)`, +e.g. ``[["other_header.h"]]``) will be treated as is, and include directories +must be available for the compiler to find them. Other header file names +(e.g. ``project_header.h``) are interpreted as being relative to the current +source directory (e.g. :variable:`CMAKE_CURRENT_SOURCE_DIR`) and will be +included by absolute path. See Also ^^^^^^^^ diff --git a/Source/cmTargetPrecompileHeadersCommand.cxx b/Source/cmTargetPrecompileHeadersCommand.cxx index 97f1bea..5751fff 100644 --- a/Source/cmTargetPrecompileHeadersCommand.cxx +++ b/Source/cmTargetPrecompileHeadersCommand.cxx @@ -2,17 +2,29 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmTargetPrecompileHeadersCommand.h" +#include "cmGeneratorExpression.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmStringAlgorithms.h" +#include "cmSystemTools.h" #include "cmTarget.h" +#include <utility> + bool cmTargetPrecompileHeadersCommand::InitialPass( std::vector<std::string> const& args, cmExecutionStatus&) { return this->HandleArguments(args, "PRECOMPILE_HEADERS", PROCESS_REUSE_FROM); } +void cmTargetPrecompileHeadersCommand::HandleInterfaceContent( + cmTarget* tgt, const std::vector<std::string>& content, bool prepend, + bool system) +{ + cmTargetPropCommandBase::HandleInterfaceContent( + tgt, ConvertToAbsoluteContent(tgt, content, true), prepend, system); +} + void cmTargetPrecompileHeadersCommand::HandleMissingTarget( const std::string& name) { @@ -31,6 +43,33 @@ std::string cmTargetPrecompileHeadersCommand::Join( bool cmTargetPrecompileHeadersCommand::HandleDirectContent( cmTarget* tgt, const std::vector<std::string>& content, bool, bool) { - tgt->AppendProperty("PRECOMPILE_HEADERS", this->Join(content).c_str()); + tgt->AppendProperty( + "PRECOMPILE_HEADERS", + this->Join(ConvertToAbsoluteContent(tgt, content, false)).c_str()); return true; } + +std::vector<std::string> +cmTargetPrecompileHeadersCommand::ConvertToAbsoluteContent( + cmTarget* /*tgt*/, const std::vector<std::string>& content, + bool /*isInterfaceContent*/) +{ + std::vector<std::string> absoluteContent; + absoluteContent.reserve(content.size()); + for (std::string const& src : content) { + std::string absoluteSrc; + // Use '<foo.h>' and '"foo.h"' includes and absolute paths as-is. + // Interpret relative paths with respect to the source directory. + // If the path starts in a generator expression, assume it is absolute. + if (cmHasLiteralPrefix(src, "<") || cmHasLiteralPrefix(src, "\"") || + cmSystemTools::FileIsFullPath(src) || + cmGeneratorExpression::Find(src) == 0) { + absoluteSrc = src; + } else { + absoluteSrc = + cmStrCat(this->Makefile->GetCurrentSourceDirectory(), '/', src); + } + absoluteContent.emplace_back(std::move(absoluteSrc)); + } + return absoluteContent; +} diff --git a/Source/cmTargetPrecompileHeadersCommand.h b/Source/cmTargetPrecompileHeadersCommand.h index 7e4558e..00dc928 100644 --- a/Source/cmTargetPrecompileHeadersCommand.h +++ b/Source/cmTargetPrecompileHeadersCommand.h @@ -28,6 +28,11 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) override; +protected: + void HandleInterfaceContent(cmTarget* tgt, + const std::vector<std::string>& content, + bool prepend, bool system) override; + private: void HandleMissingTarget(const std::string& name) override; @@ -36,6 +41,10 @@ private: bool prepend, bool system) override; std::string Join(const std::vector<std::string>& content) override; + + std::vector<std::string> ConvertToAbsoluteContent( + cmTarget* tgt, const std::vector<std::string>& content, + bool isInterfaceContent); }; #endif diff --git a/Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake b/Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake index ee47980..59ee14b 100644 --- a/Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake +++ b/Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake @@ -4,7 +4,7 @@ project(DisabledPch C) add_library(foo foo.c) target_include_directories(foo PUBLIC include) target_precompile_headers(foo PUBLIC - foo.h + include/foo.h <stdio.h> \"string.h\" ) diff --git a/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake index cbd6ede..caeb22b 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake @@ -18,19 +18,14 @@ endif() file(STRINGS ${foo_pch_header} foo_pch_header_strings) -if (NOT "#include \"foo.h\"" IN_LIST foo_pch_header_strings OR - NOT "#include <stdio.h>" IN_LIST foo_pch_header_strings OR - NOT "#include \"string.h\"" IN_LIST foo_pch_header_strings) - set(RunCMake_TEST_FAILED "Generated foo pch header ${foo_pch_header} has bad content") +if (NOT foo_pch_header_strings MATCHES ";#include \"[^\"]*PrecompileHeaders/include/foo.h\";#include \"foo2.h\";#include <stdio.h>;#include \"string.h\"(;|$)") + set(RunCMake_TEST_FAILED "Generated foo pch header\n ${foo_pch_header}\nhas bad content:\n ${foo_pch_header_strings}") return() endif() file(STRINGS ${foobar_pch_header} foobar_pch_header_strings) -if (NOT "#include \"foo.h\"" IN_LIST foobar_pch_header_strings OR - NOT "#include <stdio.h>" IN_LIST foobar_pch_header_strings OR - NOT "#include \"string.h\"" IN_LIST foobar_pch_header_strings OR - NOT "#include \"bar.h\"" IN_LIST foobar_pch_header_strings) - set(RunCMake_TEST_FAILED "Generated foobar pch header ${foobar_pch_header} has bad content") +if (NOT foobar_pch_header_strings MATCHES ";#include \"[^\"]*PrecompileHeaders/include/foo.h\";#include \"foo2.h\";#include <stdio.h>;#include \"string.h\";#include \"[^\"]*PrecompileHeaders/include/bar.h\"(;|$)") + set(RunCMake_TEST_FAILED "Generated foobar pch header\n ${foobar_pch_header}\nhas bad content:\n ${foobar_pch_header_strings}") return() endif() diff --git a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake index 9041b09..a1e0792 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake @@ -4,14 +4,15 @@ project(PchInterface C) add_library(foo foo.c) target_include_directories(foo PUBLIC include) target_precompile_headers(foo PUBLIC - foo.h + include/foo.h + \"foo2.h\" <stdio.h> \"string.h\" ) add_library(bar INTERFACE) target_include_directories(bar INTERFACE include) -target_precompile_headers(bar INTERFACE bar.h) +target_precompile_headers(bar INTERFACE include/bar.h) add_executable(foobar foobar.c) target_link_libraries(foobar foo bar) diff --git a/Tests/RunCMake/PrecompileHeaders/foo.c b/Tests/RunCMake/PrecompileHeaders/foo.c index 974a248..85ea230 100644 --- a/Tests/RunCMake/PrecompileHeaders/foo.c +++ b/Tests/RunCMake/PrecompileHeaders/foo.c @@ -1,6 +1,12 @@ #include "foo.h" +#include "foo2.h" int foo() { return 0; } + +int foo2() +{ + return 0; +} diff --git a/Tests/RunCMake/PrecompileHeaders/foobar.c b/Tests/RunCMake/PrecompileHeaders/foobar.c index 6dbf8ce..7a135ea 100644 --- a/Tests/RunCMake/PrecompileHeaders/foobar.c +++ b/Tests/RunCMake/PrecompileHeaders/foobar.c @@ -1,7 +1,8 @@ #include "bar.h" #include "foo.h" +#include "foo2.h" int main() { - return foo() + bar(); + return foo() + foo2() + bar(); } diff --git a/Tests/RunCMake/PrecompileHeaders/include/foo2.h b/Tests/RunCMake/PrecompileHeaders/include/foo2.h new file mode 100644 index 0000000..4bf9c81 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/include/foo2.h @@ -0,0 +1,6 @@ +#ifndef foo2_h +#define foo2_h + +int foo2(void); + +#endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c7c59dae82594557dc2fddc4ef881dafeaad076a commit c7c59dae82594557dc2fddc4ef881dafeaad076a Author: Daniel Eiband <daniel.eib...@brainlab.com> AuthorDate: Sun Sep 22 00:17:22 2019 +0200 Commit: Daniel Eiband <daniel.eib...@brainlab.com> CommitDate: Sun Sep 22 09:51:20 2019 +0200 cmCustomCommandGenerator: Replace generator expression member Replace generator expression member variable by stack variable in the constructor. diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index ddb855b..7f3e052 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -19,7 +19,7 @@ namespace { void AppendPaths(const std::vector<std::string>& inputs, - cmGeneratorExpression& ge, cmLocalGenerator* lg, + cmGeneratorExpression const& ge, cmLocalGenerator* lg, std::string const& config, std::vector<std::string>& output) { for (std::string const& in : inputs) { @@ -45,15 +45,15 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, , LG(lg) , OldStyle(cc.GetEscapeOldStyle()) , MakeVars(cc.GetEscapeAllowMakeVars()) - , GE(new cmGeneratorExpression(cc.GetBacktrace())) , EmulatorsWithArguments(cc.GetCommandLines().size()) { + cmGeneratorExpression ge(cc.GetBacktrace()); + const cmCustomCommandLines& cmdlines = this->CC.GetCommandLines(); for (cmCustomCommandLine const& cmdline : cmdlines) { cmCustomCommandLine argv; for (std::string const& clarg : cmdline) { - std::unique_ptr<cmCompiledGeneratorExpression> cge = - this->GE->Parse(clarg); + std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(clarg); std::string parsed_arg = cge->Evaluate(this->LG, this->Config); if (this->CC.GetCommandExpandLists()) { cmAppend(argv, cmExpandedList(parsed_arg)); @@ -72,15 +72,14 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, this->CommandLines.push_back(std::move(argv)); } - AppendPaths(cc.GetByproducts(), *this->GE, this->LG, this->Config, + AppendPaths(cc.GetByproducts(), ge, this->LG, this->Config, this->Byproducts); - AppendPaths(cc.GetDepends(), *this->GE, this->LG, this->Config, - this->Depends); + AppendPaths(cc.GetDepends(), ge, this->LG, this->Config, this->Depends); const std::string& workingdirectory = this->CC.GetWorkingDirectory(); if (!workingdirectory.empty()) { std::unique_ptr<cmCompiledGeneratorExpression> cge = - this->GE->Parse(workingdirectory); + ge.Parse(workingdirectory); this->WorkingDirectory = cge->Evaluate(this->LG, this->Config); // Convert working directory to a full path. if (!this->WorkingDirectory.empty()) { @@ -93,11 +92,6 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, this->FillEmulatorsWithArguments(); } -cmCustomCommandGenerator::~cmCustomCommandGenerator() -{ - delete this->GE; -} - unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const { return static_cast<unsigned int>(this->CC.GetCommandLines().size()); diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index d614302..50f292e 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -10,7 +10,6 @@ #include <vector> class cmCustomCommand; -class cmGeneratorExpression; class cmLocalGenerator; class cmCustomCommandGenerator @@ -20,7 +19,6 @@ class cmCustomCommandGenerator cmLocalGenerator* LG; bool OldStyle; bool MakeVars; - cmGeneratorExpression* GE; cmCustomCommandLines CommandLines; std::vector<std::vector<std::string>> EmulatorsWithArguments; std::vector<std::string> Byproducts; @@ -34,7 +32,6 @@ class cmCustomCommandGenerator public: cmCustomCommandGenerator(cmCustomCommand const& cc, std::string config, cmLocalGenerator* lg); - ~cmCustomCommandGenerator(); cmCustomCommandGenerator(const cmCustomCommandGenerator&) = delete; cmCustomCommandGenerator& operator=(const cmCustomCommandGenerator&) = delete; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c12222db86859a5a5ce9163a5309bb0da10ec616 commit c12222db86859a5a5ce9163a5309bb0da10ec616 Author: Daniel Eiband <daniel.eib...@brainlab.com> AuthorDate: Sun Sep 22 00:06:45 2019 +0200 Commit: Daniel Eiband <daniel.eib...@brainlab.com> CommitDate: Sun Sep 22 09:51:19 2019 +0200 cmGeneratorExpression: Remove Evaluate overload by parameter re-ordering Simplify by re-ordering parameters of cmCompiledGeneratorExpression::Evaluate so that frequently used parameters are before less frequently used parameters. This allows with little extra arguments to get rid of one Evaluate overload, which makes it easier to implement the cmGeneratorExpression::Evaluate utility. The latter would otherwise need four overloads. diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index 5852360..4027d4b 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -75,7 +75,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets( cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator()); std::string result = cge->Evaluate(tgt->GetLocalGenerator(), this->Config, - &gDummyHead, tgt, &dagChecker, language); + &gDummyHead, &dagChecker, tgt, language); const std::set<cmGeneratorTarget const*>& allTargets = cge->GetAllTargetsSeen(); diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 9472d9a..1bc3452 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -40,17 +40,7 @@ const std::string& cmCompiledGeneratorExpression::Evaluate( cmLocalGenerator* lg, const std::string& config, const cmGeneratorTarget* headTarget, cmGeneratorExpressionDAGChecker* dagChecker, - std::string const& language) const -{ - return this->Evaluate(lg, config, headTarget, headTarget, dagChecker, - language); -} - -const std::string& cmCompiledGeneratorExpression::Evaluate( - cmLocalGenerator* lg, const std::string& config, - const cmGeneratorTarget* headTarget, const cmGeneratorTarget* currentTarget, - cmGeneratorExpressionDAGChecker* dagChecker, - std::string const& language) const + const cmGeneratorTarget* currentTarget, std::string const& language) const { cmGeneratorExpressionContext context( lg, config, this->Quiet, headTarget, @@ -391,7 +381,7 @@ const std::string& cmGeneratorExpressionInterpreter::Evaluate( nullptr); return this->CompiledGeneratorExpression->Evaluate( - this->LocalGenerator, this->Config, this->HeadTarget, &dagChecker, + this->LocalGenerator, this->Config, this->HeadTarget, &dagChecker, nullptr, this->Language); } diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 7ed024a..322bf5c 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -90,13 +90,8 @@ public: const std::string& Evaluate( cmLocalGenerator* lg, const std::string& config, cmGeneratorTarget const* headTarget = nullptr, - cmGeneratorTarget const* currentTarget = nullptr, cmGeneratorExpressionDAGChecker* dagChecker = nullptr, - std::string const& language = std::string()) const; - const std::string& Evaluate( - cmLocalGenerator* lg, const std::string& config, - cmGeneratorTarget const* headTarget, - cmGeneratorExpressionDAGChecker* dagChecker, + cmGeneratorTarget const* currentTarget = nullptr, std::string const& language = std::string()) const; /** Get set of targets found during evaluations. */ diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 419a82c..641cbaf 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -45,15 +45,15 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression( std::string const& prop, cmLocalGenerator* lg, cmGeneratorExpressionContext* context, cmGeneratorTarget const* headTarget, - cmGeneratorTarget const* currentTarget, - cmGeneratorExpressionDAGChecker* dagChecker) + cmGeneratorExpressionDAGChecker* dagChecker, + cmGeneratorTarget const* currentTarget) { cmGeneratorExpression ge(context->Backtrace); std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); cge->SetQuiet(context->Quiet); std::string result = - cge->Evaluate(lg, context->Config, headTarget, currentTarget, dagChecker, + cge->Evaluate(lg, context->Config, headTarget, dagChecker, currentTarget, context->Language); if (cge->GetHadContextSensitiveCondition()) { context->HadContextSensitiveCondition = true; @@ -478,13 +478,13 @@ protected: } return this->EvaluateDependentExpression( - expression, context->LG, context, context->HeadTarget, - context->CurrentTarget, &dagChecker); + expression, context->LG, context, context->HeadTarget, &dagChecker, + context->CurrentTarget); } return this->EvaluateDependentExpression( - expression, context->LG, context, context->HeadTarget, - context->CurrentTarget, dagCheckerParent); + expression, context->LG, context, context->HeadTarget, dagCheckerParent, + context->CurrentTarget); } }; @@ -1332,7 +1332,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode if (!interfacePropertyName.empty()) { result = this->EvaluateDependentExpression(result, context->LG, context, - target, target, &dagChecker); + target, &dagChecker, target); std::string linkedTargetsContent = getLinkedTargetsContent( target, interfacePropertyName, context, &dagChecker); if (!linkedTargetsContent.empty()) { diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h index 7a36924..13e8484 100644 --- a/Source/cmGeneratorExpressionNode.h +++ b/Source/cmGeneratorExpressionNode.h @@ -43,8 +43,8 @@ struct cmGeneratorExpressionNode static std::string EvaluateDependentExpression( std::string const& prop, cmLocalGenerator* lg, cmGeneratorExpressionContext* context, const cmGeneratorTarget* headTarget, - const cmGeneratorTarget* currentTarget, - cmGeneratorExpressionDAGChecker* dagChecker); + cmGeneratorExpressionDAGChecker* dagChecker, + const cmGeneratorTarget* currentTarget); static const cmGeneratorExpressionNode* GetNode( const std::string& identifier); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 454bcbc..b66d9d5 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -112,7 +112,8 @@ public: cmGeneratorExpressionDAGChecker* dagChecker, std::string const& language) const override { - return this->ge->Evaluate(lg, config, headTarget, dagChecker, language); + return this->ge->Evaluate(lg, config, headTarget, dagChecker, nullptr, + language); } cmListFileBacktrace GetBacktrace() const override @@ -709,8 +710,8 @@ void handleSystemIncludesDep(cmLocalGenerator* lg, if (const char* dirs = depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")) { cmGeneratorExpression ge; - cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, depTgt, - dagChecker, language), + cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, dagChecker, + depTgt, language), result); } if (!depTgt->IsImported() || excludeImported) { @@ -720,8 +721,8 @@ void handleSystemIncludesDep(cmLocalGenerator* lg, if (const char* dirs = depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) { cmGeneratorExpression ge; - cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, depTgt, - dagChecker, language), + cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, dagChecker, + depTgt, language), result); } } @@ -1093,7 +1094,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory( for (std::string const& it : this->Target->GetSystemIncludeDirectories()) { cmGeneratorExpression ge; cmExpandList(ge.Parse(it)->Evaluate(this->LocalGenerator, config, this, - &dagChecker, language), + &dagChecker, nullptr, language), result); } @@ -1199,7 +1200,7 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty( if (const char* p = this->GetProperty(prop)) { result = cmGeneratorExpressionNode::EvaluateDependentExpression( - p, context->LG, context, headTarget, this, &dagChecker); + p, context->LG, context, headTarget, &dagChecker, this); } if (cmLinkInterfaceLibraries const* iface = @@ -5287,7 +5288,7 @@ void cmGeneratorTarget::ExpandLinkItems( std::vector<std::string> libs; std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); cmExpandList( - cge->Evaluate(this->LocalGenerator, config, headTarget, this, &dagChecker), + cge->Evaluate(this->LocalGenerator, config, headTarget, &dagChecker, this), libs); this->LookupLinkItems(libs, cge->GetBacktrace(), items); hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition(); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1811411fecf3d9769ad7a13f6ecd01c5351df9c4 commit 1811411fecf3d9769ad7a13f6ecd01c5351df9c4 Author: Daniel Eiband <daniel.eib...@brainlab.com> AuthorDate: Sat Sep 21 23:39:48 2019 +0200 Commit: Daniel Eiband <daniel.eib...@brainlab.com> CommitDate: Sun Sep 22 09:49:41 2019 +0200 cmGeneratorExpression: Move quiet flag to cmCompiledGeneratorExpression The quiet flag is false for all but one call to Evaluate. Make the quiet flag a setter of cmCompiledGeneratorExpression to be able to remove it from the Evaluate function signature. diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index f9a28cd..e142560 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -380,7 +380,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( this->ReplaceInstallPrefix(dirs); std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs); std::string exportDirs = - cge->Evaluate(target->GetLocalGenerator(), "", false, target); + cge->Evaluate(target->GetLocalGenerator(), "", target); if (cge->GetHadContextSensitiveCondition()) { cmLocalGenerator* lg = target->GetLocalGenerator(); diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index 5631d60..5852360 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -74,9 +74,8 @@ std::string cmExportTryCompileFileGenerator::FindTargets( cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator()); - std::string result = - cge->Evaluate(tgt->GetLocalGenerator(), this->Config, false, &gDummyHead, - tgt, &dagChecker, language); + std::string result = cge->Evaluate(tgt->GetLocalGenerator(), this->Config, + &gDummyHead, tgt, &dagChecker, language); const std::set<cmGeneratorTarget const*>& allTargets = cge->GetAllTargetsSeen(); diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index f49ed2c..9472d9a 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -21,40 +21,41 @@ cmGeneratorExpression::cmGeneratorExpression(cmListFileBacktrace backtrace) { } +cmGeneratorExpression::~cmGeneratorExpression() = default; + std::unique_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse( - std::string const& input) + std::string input) const { return std::unique_ptr<cmCompiledGeneratorExpression>( - new cmCompiledGeneratorExpression(this->Backtrace, input)); + new cmCompiledGeneratorExpression(this->Backtrace, std::move(input))); } std::unique_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse( - const char* input) + const char* input) const { return this->Parse(std::string(input ? input : "")); } -cmGeneratorExpression::~cmGeneratorExpression() = default; - const std::string& cmCompiledGeneratorExpression::Evaluate( - cmLocalGenerator* lg, const std::string& config, bool quiet, + cmLocalGenerator* lg, const std::string& config, const cmGeneratorTarget* headTarget, cmGeneratorExpressionDAGChecker* dagChecker, std::string const& language) const { - return this->Evaluate(lg, config, quiet, headTarget, headTarget, dagChecker, + return this->Evaluate(lg, config, headTarget, headTarget, dagChecker, language); } const std::string& cmCompiledGeneratorExpression::Evaluate( - cmLocalGenerator* lg, const std::string& config, bool quiet, + cmLocalGenerator* lg, const std::string& config, const cmGeneratorTarget* headTarget, const cmGeneratorTarget* currentTarget, cmGeneratorExpressionDAGChecker* dagChecker, std::string const& language) const { cmGeneratorExpressionContext context( - lg, config, quiet, headTarget, currentTarget ? currentTarget : headTarget, - this->EvaluateForBuildsystem, this->Backtrace, language); + lg, config, this->Quiet, headTarget, + currentTarget ? currentTarget : headTarget, this->EvaluateForBuildsystem, + this->Backtrace, language); return this->EvaluateWithContext(context, dagChecker); } @@ -97,9 +98,10 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( cmListFileBacktrace backtrace, std::string input) : Backtrace(std::move(backtrace)) , Input(std::move(input)) + , EvaluateForBuildsystem(false) + , Quiet(false) , HadContextSensitiveCondition(false) , HadHeadSensitiveCondition(false) - , EvaluateForBuildsystem(false) { cmGeneratorExpressionLexer l; std::vector<cmGeneratorExpressionToken> tokens = l.Tokenize(this->Input); @@ -377,10 +379,10 @@ void cmCompiledGeneratorExpression::GetMaxLanguageStandard( } const std::string& cmGeneratorExpressionInterpreter::Evaluate( - const char* expression, const std::string& property) + std::string expression, const std::string& property) { this->CompiledGeneratorExpression = - this->GeneratorExpression.Parse(expression); + this->GeneratorExpression.Parse(std::move(expression)); // Specify COMPILE_OPTIONS to DAGchecker, same semantic as COMPILE_FLAGS cmGeneratorExpressionDAGChecker dagChecker( @@ -389,6 +391,12 @@ const std::string& cmGeneratorExpressionInterpreter::Evaluate( nullptr); return this->CompiledGeneratorExpression->Evaluate( - this->LocalGenerator, this->Config, false, this->HeadTarget, &dagChecker, + this->LocalGenerator, this->Config, this->HeadTarget, &dagChecker, this->Language); } + +const std::string& cmGeneratorExpressionInterpreter::Evaluate( + const char* expression, const std::string& property) +{ + return this->Evaluate(std::string(expression ? expression : ""), property); +} diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index ef76651..7ed024a 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -41,8 +41,9 @@ public: cmGeneratorExpression& operator=(cmGeneratorExpression const&) = delete; std::unique_ptr<cmCompiledGeneratorExpression> Parse( - std::string const& input); - std::unique_ptr<cmCompiledGeneratorExpression> Parse(const char* input); + std::string input) const; + std::unique_ptr<cmCompiledGeneratorExpression> Parse( + const char* input) const; enum PreprocessContext { @@ -87,13 +88,13 @@ public: cmCompiledGeneratorExpression const&) = delete; const std::string& Evaluate( - cmLocalGenerator* lg, const std::string& config, bool quiet = false, + cmLocalGenerator* lg, const std::string& config, cmGeneratorTarget const* headTarget = nullptr, cmGeneratorTarget const* currentTarget = nullptr, cmGeneratorExpressionDAGChecker* dagChecker = nullptr, std::string const& language = std::string()) const; const std::string& Evaluate( - cmLocalGenerator* lg, const std::string& config, bool quiet, + cmLocalGenerator* lg, const std::string& config, cmGeneratorTarget const* headTarget, cmGeneratorExpressionDAGChecker* dagChecker, std::string const& language = std::string()) const; @@ -135,6 +136,8 @@ public: this->EvaluateForBuildsystem = eval; } + void SetQuiet(bool quiet) { this->Quiet = quiet; } + void GetMaxLanguageStandard(cmGeneratorTarget const* tgt, std::map<std::string, std::string>& mapping); @@ -152,6 +155,8 @@ private: std::vector<cmGeneratorExpressionEvaluator*> Evaluators; const std::string Input; bool NeedsEvaluation; + bool EvaluateForBuildsystem; + bool Quiet; mutable std::set<cmGeneratorTarget*> DependTargets; mutable std::set<cmGeneratorTarget const*> AllTargetsSeen; @@ -163,7 +168,6 @@ private: mutable bool HadContextSensitiveCondition; mutable bool HadHeadSensitiveCondition; mutable std::set<cmGeneratorTarget const*> SourceSensitiveTargets; - bool EvaluateForBuildsystem; }; class cmGeneratorExpressionInterpreter @@ -172,11 +176,11 @@ public: cmGeneratorExpressionInterpreter(cmLocalGenerator* localGenerator, std::string config, cmGeneratorTarget const* headTarget, - std::string lang = std::string()) + std::string language = std::string()) : LocalGenerator(localGenerator) , Config(std::move(config)) , HeadTarget(headTarget) - , Language(std::move(lang)) + , Language(std::move(language)) { } @@ -185,13 +189,10 @@ public: cmGeneratorExpressionInterpreter& operator=( cmGeneratorExpressionInterpreter const&) = delete; + const std::string& Evaluate(std::string expression, + const std::string& property); const std::string& Evaluate(const char* expression, const std::string& property); - const std::string& Evaluate(const std::string& expression, - const std::string& property) - { - return this->Evaluate(expression.c_str(), property); - } protected: cmGeneratorExpression GeneratorExpression; diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index eb43270..aa2c1a6 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -37,8 +37,8 @@ void cmGeneratorExpressionEvaluationFile::Generate( { std::string rawCondition = this->Condition->GetInput(); if (!rawCondition.empty()) { - std::string condResult = this->Condition->Evaluate( - lg, config, false, nullptr, nullptr, nullptr, lang); + std::string condResult = + this->Condition->Evaluate(lg, config, nullptr, nullptr, nullptr, lang); if (condResult == "0") { return; } @@ -54,9 +54,9 @@ void cmGeneratorExpressionEvaluationFile::Generate( } std::string outputFileName = this->OutputFileExpr->Evaluate( - lg, config, false, nullptr, nullptr, nullptr, lang); - const std::string& outputContent = inputExpression->Evaluate( - lg, config, false, nullptr, nullptr, nullptr, lang); + lg, config, nullptr, nullptr, nullptr, lang); + const std::string& outputContent = + inputExpression->Evaluate(lg, config, nullptr, nullptr, nullptr, lang); if (cmSystemTools::FileIsFullPath(outputFileName)) { outputFileName = cmSystemTools::CollapseFullPath(outputFileName); @@ -100,8 +100,8 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile( gg->GetEnabledLanguages(enabledLanguages); for (std::string const& le : enabledLanguages) { - std::string name = this->OutputFileExpr->Evaluate( - lg, config, false, nullptr, nullptr, nullptr, le); + std::string name = this->OutputFileExpr->Evaluate(lg, config, nullptr, + nullptr, nullptr, le); cmSourceFile* sf = lg->GetMakefile()->GetOrCreateSource( name, false, cmSourceFileLocationKind::Known); // Tell TraceDependencies that the file is not expected to exist diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index d524867..419a82c 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -51,9 +51,10 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression( cmGeneratorExpression ge(context->Backtrace); std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); + cge->SetQuiet(context->Quiet); std::string result = - cge->Evaluate(lg, context->Config, context->Quiet, headTarget, - currentTarget, dagChecker, context->Language); + cge->Evaluate(lg, context->Config, headTarget, currentTarget, dagChecker, + context->Language); if (cge->GetHadContextSensitiveCondition()) { context->HadContextSensitiveCondition = true; } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 372b83d..454bcbc 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -112,8 +112,7 @@ public: cmGeneratorExpressionDAGChecker* dagChecker, std::string const& language) const override { - return this->ge->Evaluate(lg, config, false, headTarget, dagChecker, - language); + return this->ge->Evaluate(lg, config, headTarget, dagChecker, language); } cmListFileBacktrace GetBacktrace() const override @@ -710,8 +709,8 @@ void handleSystemIncludesDep(cmLocalGenerator* lg, if (const char* dirs = depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")) { cmGeneratorExpression ge; - cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, false, headTarget, - depTgt, dagChecker, language), + cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, depTgt, + dagChecker, language), result); } if (!depTgt->IsImported() || excludeImported) { @@ -721,8 +720,8 @@ void handleSystemIncludesDep(cmLocalGenerator* lg, if (const char* dirs = depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) { cmGeneratorExpression ge; - cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, false, headTarget, - depTgt, dagChecker, language), + cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, depTgt, + dagChecker, language), result); } } @@ -1093,8 +1092,8 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory( std::vector<std::string> result; for (std::string const& it : this->Target->GetSystemIncludeDirectories()) { cmGeneratorExpression ge; - cmExpandList(ge.Parse(it)->Evaluate(this->LocalGenerator, config, false, - this, &dagChecker, language), + cmExpandList(ge.Parse(it)->Evaluate(this->LocalGenerator, config, this, + &dagChecker, language), result); } @@ -1290,7 +1289,7 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget, EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace); cmExpandList(cge->Evaluate(headTarget->GetLocalGenerator(), config, - false, headTarget, dagChecker), + headTarget, dagChecker), ee.Values); if (cge->GetHadContextSensitiveCondition()) { ee.ContextDependent = true; @@ -2519,9 +2518,9 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result, cmGeneratorExpressionDAGChecker dagChecker(this, "AUTOUIC_OPTIONS", nullptr, nullptr); - cmExpandList(ge.Parse(prop)->Evaluate(this->LocalGenerator, config, false, - this, &dagChecker), - result); + cmExpandList( + ge.Parse(prop)->Evaluate(this->LocalGenerator, config, this, &dagChecker), + result); } void processILibs(const std::string& config, @@ -2790,7 +2789,8 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc) // Check for target references in generator expressions. for (std::string const& cl : cCmdLine) { const std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(cl); - cge->Evaluate(this->GeneratorTarget->GetLocalGenerator(), "", true); + cge->SetQuiet(true); + cge->Evaluate(this->GeneratorTarget->GetLocalGenerator(), ""); std::set<cmGeneratorTarget*> geTargets = cge->GetTargets(); targets.insert(geTargets.begin(), geTargets.end()); } @@ -5286,9 +5286,9 @@ void cmGeneratorTarget::ExpandLinkItems( } std::vector<std::string> libs; std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); - cmExpandList(cge->Evaluate(this->LocalGenerator, config, false, headTarget, - this, &dagChecker), - libs); + cmExpandList( + cge->Evaluate(this->LocalGenerator, config, headTarget, this, &dagChecker), + libs); this->LookupLinkItems(libs, cge->GetBacktrace(), items); hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition(); } @@ -6358,7 +6358,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( cmGeneratorExpression ge(*btIt); std::unique_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(*le); std::string const& evaluated = - cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker); + cge->Evaluate(this->LocalGenerator, config, head, &dagChecker); cmExpandList(evaluated, llibs); if (cge->GetHadHeadSensitiveCondition()) { impl.HadHeadSensitiveCondition = true; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e059548..19962e3 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1713,8 +1713,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, cmGeneratorExpression ge; std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(msvcRuntimeLibraryValue); - std::string const msvcRuntimeLibrary = - cge->Evaluate(this, config, false, target); + std::string const msvcRuntimeLibrary = cge->Evaluate(this, config, target); if (!msvcRuntimeLibrary.empty()) { if (const char* msvcRuntimeLibraryOptions = this->Makefile->GetDefinition( diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 482af22..fa361bb 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -156,7 +156,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() std::vector<std::string> files; cmGeneratorExpression ge; std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop_value); - cmExpandList(cge->Evaluate(this->LocalGenerator, this->ConfigName, false, + cmExpandList(cge->Evaluate(this->LocalGenerator, this->ConfigName, this->GeneratorTarget, nullptr, nullptr), files); return files; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 2ab5adf..bee044e 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1322,7 +1322,7 @@ void cmNinjaTargetGenerator::AdditionalCleanFiles() auto cge = ge.Parse(prop_value); cmExpandList(cge->Evaluate( lg, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"), - false, this->GeneratorTarget, nullptr, nullptr), + this->GeneratorTarget, nullptr, nullptr), cleanFiles); } std::string const& binaryDir = lg->GetCurrentBinaryDirectory(); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=edb0bbd18b5c3dac16ab7d219f787513203529e4 commit edb0bbd18b5c3dac16ab7d219f787513203529e4 Author: Daniel Eiband <daniel.eib...@brainlab.com> AuthorDate: Sat Sep 21 22:23:41 2019 +0200 Commit: Daniel Eiband <daniel.eib...@brainlab.com> CommitDate: Sat Sep 21 22:40:57 2019 +0200 cmGeneratorTarget: Remove unused virtual signature of TargetPropertyEntry Remove unused virtual Evaluate signature of TargetPropertyEntry. Also remove the boolean parameter quiet. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 18ca478..372b83d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -84,16 +84,10 @@ public: virtual ~TargetPropertyEntry() = default; virtual const std::string& Evaluate( - cmLocalGenerator* lg, const std::string& config, bool quiet = false, - cmGeneratorTarget const* headTarget = nullptr, - cmGeneratorTarget const* currentTarget = nullptr, - cmGeneratorExpressionDAGChecker* dagChecker = nullptr, - std::string const& language = std::string()) const = 0; - virtual const std::string& Evaluate( - cmLocalGenerator* lg, const std::string& config, bool quiet, + cmLocalGenerator* lg, const std::string& config, cmGeneratorTarget const* headTarget, cmGeneratorExpressionDAGChecker* dagChecker, - std::string const& language = std::string()) const = 0; + std::string const& language) const = 0; virtual cmListFileBacktrace GetBacktrace() const = 0; virtual std::string const& GetInput() const = 0; @@ -113,23 +107,12 @@ public: { } - const std::string& Evaluate( - cmLocalGenerator* lg, const std::string& config, bool quiet = false, - cmGeneratorTarget const* headTarget = nullptr, - cmGeneratorTarget const* currentTarget = nullptr, - cmGeneratorExpressionDAGChecker* dagChecker = nullptr, - std::string const& language = std::string()) const override - { - return this->ge->Evaluate(lg, config, quiet, headTarget, currentTarget, - dagChecker, language); - } - const std::string& Evaluate( - cmLocalGenerator* lg, const std::string& config, bool quiet, - cmGeneratorTarget const* headTarget, - cmGeneratorExpressionDAGChecker* dagChecker, - std::string const& language = std::string()) const override + const std::string& Evaluate(cmLocalGenerator* lg, const std::string& config, + cmGeneratorTarget const* headTarget, + cmGeneratorExpressionDAGChecker* dagChecker, + std::string const& language) const override { - return this->ge->Evaluate(lg, config, quiet, headTarget, dagChecker, + return this->ge->Evaluate(lg, config, false, headTarget, dagChecker, language); } @@ -161,15 +144,7 @@ public: { } - const std::string& Evaluate(cmLocalGenerator*, const std::string&, bool, - cmGeneratorTarget const*, - cmGeneratorTarget const*, - cmGeneratorExpressionDAGChecker*, - std::string const&) const override - { - return this->PropertyValue; - } - const std::string& Evaluate(cmLocalGenerator*, const std::string&, bool, + const std::string& Evaluate(cmLocalGenerator*, const std::string&, cmGeneratorTarget const*, cmGeneratorExpressionDAGChecker*, std::string const&) const override @@ -198,7 +173,7 @@ cmGeneratorTarget::TargetPropertyEntry* CreateTargetPropertyEntry( return new TargetPropertyEntryGenex(std::move(cge)); } - return new TargetPropertyEntryString(propertyValue, backtrace); + return new TargetPropertyEntryString(propertyValue, std::move(backtrace)); } void CreatePropertyGeneratorExpressions( @@ -245,7 +220,7 @@ EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry( cmGeneratorTarget::TargetPropertyEntry* entry) { EvaluatedTargetPropertyEntry ee(entry->LinkImplItem, entry->GetBacktrace()); - cmExpandList(entry->Evaluate(thisTarget->GetLocalGenerator(), config, false, + cmExpandList(entry->Evaluate(thisTarget->GetLocalGenerator(), config, thisTarget, dagChecker, lang), ee.Values); if (entry->GetHadContextSensitiveCondition()) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8456f60dbc13b9fbd0490371c871a1e85a72c3a8 commit 8456f60dbc13b9fbd0490371c871a1e85a72c3a8 Author: Daniel Eiband <daniel.eib...@brainlab.com> AuthorDate: Sat Sep 21 13:31:36 2019 +0200 Commit: Daniel Eiband <daniel.eib...@brainlab.com> CommitDate: Sat Sep 21 13:31:36 2019 +0200 cmSourceFile: Remove non-const GetProperties accessor Manipulating the property map of cmSourceFile directly may invalidate the class invariant of the cached value IsGenerated. Provide the setter SetProperties which also updates IsGenerated. diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 9c7beca..1eaf48b 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -561,7 +561,7 @@ void* CCONV cmAddSource(void* arg, void* arg2) // Create the real cmSourceFile instance and copy over saved information. cmSourceFile* rsf = mf->GetOrCreateSource(osf->FullPath); - rsf->GetProperties() = osf->Properties; + rsf->SetProperties(osf->Properties); for (std::string const& d : osf->Depends) { rsf->AddDepend(d); } diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 3344217..bd68d04 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -314,6 +314,13 @@ bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const return cmIsOn(this->GetProperty(prop)); } +void cmSourceFile::SetProperties(cmPropertyMap properties) +{ + this->Properties = std::move(properties); + + this->IsGenerated = this->GetPropertyAsBool(propGENERATED); +} + cmCustomCommand* cmSourceFile::GetCustomCommand() const { return this->CustomCommand.get(); diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index ff465c7..3b18fdb 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -94,8 +94,9 @@ public: void AddDepend(const std::string& d) { this->Depends.push_back(d); } // Get the properties - cmPropertyMap& GetProperties() { return this->Properties; } const cmPropertyMap& GetProperties() const { return this->Properties; } + // Set the properties + void SetProperties(cmPropertyMap properties); /** * Check whether the given source file location could refer to this https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f4afcd5c6bee7604e031aaab2fa38a9e9ba93900 commit f4afcd5c6bee7604e031aaab2fa38a9e9ba93900 Author: Daniel Eiband <daniel.eib...@brainlab.com> AuthorDate: Thu Aug 29 10:25:34 2019 +0200 Commit: Daniel Eiband <daniel.eib...@brainlab.com> CommitDate: Sat Sep 21 12:56:10 2019 +0200 VS: Remove call to ConvertToWindowsExtendedPath with result discarded Remove call to ConvertToWindowsExtendedPath. The call has no side effect and the return value is discarded. diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 61e8f58..108a44f 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -901,7 +901,6 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); std::string obj_dir = gt->ObjectDirectory; std::string cmakeCommand = cmSystemTools::GetCMakeCommand(); - cmSystemTools::ConvertToWindowsExtendedPath(cmakeCommand); std::string obj_dir_expanded = obj_dir; cmSystemTools::ReplaceString(obj_dir_expanded, this->GetCMakeCFGIntDir(), configName.c_str()); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61fdf326d8e762aaaef22d8ecce443674d5205e6 commit 61fdf326d8e762aaaef22d8ecce443674d5205e6 Author: Daniel Eiband <daniel.eib...@brainlab.com> AuthorDate: Sat Sep 21 12:51:25 2019 +0200 Commit: Daniel Eiband <daniel.eib...@brainlab.com> CommitDate: Sat Sep 21 12:56:05 2019 +0200 cmState: Avoid lowering command name twice The given command given to GetCommand is already lower case so we can use GetCommandByExactName directly. diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 93ad2d7..6de312c 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -503,7 +503,7 @@ void cmState::AddScriptedCommand(std::string const& name, Command command) std::string sName = cmSystemTools::LowerCase(name); // if the command already exists, give a new name to the old command. - if (Command oldCmd = this->GetCommand(sName)) { + if (Command oldCmd = this->GetCommandByExactName(sName)) { this->ScriptedCommands["_" + sName] = oldCmd; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0965bd9c064a5a595ca1bde01e8dba425ea2b916 commit 0965bd9c064a5a595ca1bde01e8dba425ea2b916 Author: Daniel Eiband <daniel.eib...@brainlab.com> AuthorDate: Sat Sep 21 12:48:26 2019 +0200 Commit: Daniel Eiband <daniel.eib...@brainlab.com> CommitDate: Sat Sep 21 12:55:37 2019 +0200 Generators: Remove function declarations which do not have a definition diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 372e658..3075c1a 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -555,8 +555,6 @@ protected: cmTarget* FindTargetImpl(std::string const& name) const; cmGeneratorTarget* FindGeneratorTargetImpl(std::string const& name) const; - cmGeneratorTarget* FindImportedGeneratorTargetImpl( - std::string const& name) const; const char* GetPredefinedTargetsFolder(); diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 08bec70..f64534c 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -93,7 +93,6 @@ private: void WriteProcessedMakefile(std::ostream& os); void WritePools(std::ostream& os); - void WriteCustomCommandRule(); void WriteCustomCommandBuildStatement(cmCustomCommand const* cc, const cmNinjaDeps& orderOnlyDeps); ----------------------------------------------------------------------- Summary of changes: Help/command/target_precompile_headers.rst | 21 +++- Source/cmCPluginAPI.cxx | 2 +- Source/cmCustomCommandGenerator.cxx | 20 ++-- Source/cmCustomCommandGenerator.h | 3 - Source/cmExportFileGenerator.cxx | 2 +- Source/cmExportTryCompileFileGenerator.cxx | 5 +- Source/cmGeneratorExpression.cxx | 61 +++++++---- Source/cmGeneratorExpression.h | 43 ++++---- Source/cmGeneratorExpressionEvaluationFile.cxx | 14 +-- Source/cmGeneratorExpressionNode.cxx | 19 ++-- Source/cmGeneratorExpressionNode.h | 4 +- Source/cmGeneratorTarget.cxx | 111 +++++++-------------- Source/cmGlobalGenerator.h | 2 - Source/cmGlobalVisualStudio7Generator.cxx | 6 +- Source/cmGlobalVisualStudio8Generator.cxx | 8 +- Source/cmGlobalVisualStudioGenerator.cxx | 1 - Source/cmGlobalXCodeGenerator.cxx | 13 +-- Source/cmInstallDirectoryGenerator.cxx | 11 +- Source/cmInstallFilesGenerator.cxx | 11 +- Source/cmInstallScriptGenerator.cxx | 7 +- Source/cmInstallTargetGenerator.cxx | 6 +- Source/cmJsonObjects.cxx | 12 +-- Source/cmLocalGenerator.cxx | 14 +-- Source/cmLocalNinjaGenerator.cxx | 10 +- Source/cmLocalNinjaGenerator.h | 1 - Source/cmLocalUnixMakefileGenerator3.cxx | 10 +- Source/cmMakefileTargetGenerator.cxx | 9 +- Source/cmNinjaTargetGenerator.cxx | 13 +-- Source/cmSourceFile.cxx | 7 ++ Source/cmSourceFile.h | 3 +- Source/cmState.cxx | 2 +- Source/cmTargetPrecompileHeadersCommand.cxx | 41 +++++++- Source/cmTargetPrecompileHeadersCommand.h | 9 ++ Source/cmVisualStudio10TargetGenerator.cxx | 60 +++-------- Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake | 2 +- .../PrecompileHeaders/PchInterface-check.cmake | 13 +-- .../RunCMake/PrecompileHeaders/PchInterface.cmake | 5 +- Tests/RunCMake/PrecompileHeaders/foo.c | 6 ++ Tests/RunCMake/PrecompileHeaders/foobar.c | 3 +- Tests/RunCMake/PrecompileHeaders/include/foo2.h | 6 ++ 40 files changed, 298 insertions(+), 298 deletions(-) create mode 100644 Tests/RunCMake/PrecompileHeaders/include/foo2.h hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits