diff options
author | Brad King <brad.king@kitware.com> | 2020-06-02 12:02:14 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-06-02 12:02:24 (GMT) |
commit | a432b1075c8808c6e4c925d3f4d4ce94c5477bab (patch) | |
tree | cbf85da9bdbfdd82e2e0fa6d210478840f82b2da | |
parent | ec7b5f21eef8bc0d6da729aa0f61ddccc7a06f3b (diff) | |
parent | 7ed8c9ebe33ccafc41ec9e096bf2884d617a0ebf (diff) | |
download | CMake-a432b1075c8808c6e4c925d3f4d4ce94c5477bab.zip CMake-a432b1075c8808c6e4c925d3f4d4ce94c5477bab.tar.gz CMake-a432b1075c8808c6e4c925d3f4d4ce94c5477bab.tar.bz2 |
Merge topic 'getdef-expand'
7ed8c9ebe3 cmMakefile: add GetDefExpandList() that splits value into std::vector
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4819
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 33 | ||||
-rw-r--r-- | Source/cmDependsC.cxx | 4 | ||||
-rw-r--r-- | Source/cmDependsFortran.cxx | 10 | ||||
-rw-r--r-- | Source/cmFindCommon.cxx | 8 | ||||
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 63 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 9 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 17 | ||||
-rw-r--r-- | Source/cmMakefile.h | 2 | ||||
-rw-r--r-- | Source/cmMakefileExecutableTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 15 | ||||
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 5 | ||||
-rw-r--r-- | Source/cmake.cxx | 11 |
16 files changed, 70 insertions, 137 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index c27e94f..4c5f57d 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1331,18 +1331,13 @@ void cmComputeLinkInformation::ComputeFrameworkInfo() std::vector<std::string> implicitDirVec; // Get platform-wide implicit directories. - if (const char* implicitLinks = this->Makefile->GetDefinition( - "CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES")) { - cmExpandList(implicitLinks, implicitDirVec); - } + this->Makefile->GetDefExpandList( + "CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES", implicitDirVec); // Get language-specific implicit directories. std::string implicitDirVar = cmStrCat( "CMAKE_", this->LinkLanguage, "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES"); - if (const char* implicitDirs = - this->Makefile->GetDefinition(implicitDirVar)) { - cmExpandList(implicitDirs, implicitDirVec); - } + this->Makefile->GetDefExpandList(implicitDirVar, implicitDirVec); this->FrameworkPathsEmmitted.insert(implicitDirVec.begin(), implicitDirVec.end()); @@ -1555,10 +1550,8 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() std::vector<std::string> implicitDirVec; // Get platform-wide implicit directories. - if (const char* implicitLinks = (this->Makefile->GetDefinition( - "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES"))) { - cmExpandList(implicitLinks, implicitDirVec); - } + this->Makefile->GetDefExpandList("CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES", + implicitDirVec); // Append library architecture to all implicit platform directories // and add them to the set @@ -1572,10 +1565,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() // Get language-specific implicit directories. std::string implicitDirVar = cmStrCat("CMAKE_", this->LinkLanguage, "_IMPLICIT_LINK_DIRECTORIES"); - if (const char* implicitDirs = - this->Makefile->GetDefinition(implicitDirVar)) { - cmExpandList(implicitDirs, implicitDirVec); - } + this->Makefile->GetDefExpandList(implicitDirVar, implicitDirVec); // Store implicit link directories. this->ImplicitLinkDirs.insert(implicitDirVec.begin(), implicitDirVec.end()); @@ -1584,10 +1574,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() std::vector<std::string> implicitLibVec; std::string implicitLibVar = cmStrCat("CMAKE_", this->LinkLanguage, "_IMPLICIT_LINK_LIBRARIES"); - if (const char* implicitLibs = - this->Makefile->GetDefinition(implicitLibVar)) { - cmExpandList(implicitLibs, implicitLibVec); - } + this->Makefile->GetDefExpandList(implicitLibVar, implicitLibVec); // Store implicit link libraries. for (std::string const& item : implicitLibVec) { @@ -1599,10 +1586,8 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() } // Get platform specific rpath link directories - if (const char* rpathDirs = - (this->Makefile->GetDefinition("CMAKE_PLATFORM_RUNTIME_PATH"))) { - cmExpandList(rpathDirs, this->RuntimeLinkDirs); - } + this->Makefile->GetDefExpandList("CMAKE_PLATFORM_RUNTIME_PATH", + this->RuntimeLinkDirs); } std::vector<std::string> const& diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 4499a66..e05c964 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -384,9 +384,7 @@ void cmDependsC::SetupTransforms() // Get the transformation rules. std::vector<std::string> transformRules; cmMakefile* mf = this->LocalGenerator->GetMakefile(); - if (const char* xform = mf->GetDefinition("CMAKE_INCLUDE_TRANSFORMS")) { - cmExpandList(xform, transformRules, true); - } + mf->GetDefExpandList("CMAKE_INCLUDE_TRANSFORMS", transformRules, true); for (std::string const& tr : transformRules) { this->ParseTransform(tr); } diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 95dfc4e..8f02d95 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -80,10 +80,7 @@ cmDependsFortran::cmDependsFortran(cmLocalUnixMakefileGenerator3* lg) // Get the list of definitions. std::vector<std::string> definitions; cmMakefile* mf = this->LocalGenerator->GetMakefile(); - if (const char* c_defines = - mf->GetDefinition("CMAKE_TARGET_DEFINITIONS_Fortran")) { - cmExpandList(c_defines, definitions); - } + mf->GetDefExpandList("CMAKE_TARGET_DEFINITIONS_Fortran", definitions); // translate i.e. FOO=BAR to FOO and add it to the list of defined // preprocessor symbols @@ -243,10 +240,7 @@ void cmDependsFortran::LocateModules() // Load information about other targets. cmMakefile* mf = this->LocalGenerator->GetMakefile(); std::vector<std::string> infoFiles; - if (const char* infoFilesValue = - mf->GetDefinition("CMAKE_TARGET_LINKED_INFO_FILES")) { - cmExpandList(infoFilesValue, infoFiles); - } + mf->GetDefExpandList("CMAKE_TARGET_LINKED_INFO_FILES", infoFiles); for (std::string const& i : infoFiles) { std::string targetDir = cmSystemTools::GetFilenamePath(i); std::string fname = targetDir + "/fortran.internal"; diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 82acfed..3e97150 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -4,7 +4,6 @@ #include <algorithm> #include <array> -#include <cstring> #include <utility> #include <cmext/algorithm> @@ -280,12 +279,7 @@ void cmFindCommon::GetIgnoredPaths(std::vector<std::string>& ignore) // Construct the list of path roots with no trailing slashes. for (const char** pathName = paths; *pathName; ++pathName) { // Get the list of paths to ignore from the variable. - const char* ignorePath = this->Makefile->GetDefinition(*pathName); - if ((ignorePath == nullptr) || (strlen(ignorePath) == 0)) { - continue; - } - - cmExpandList(ignorePath, ignore); + this->Makefile->GetDefExpandList(*pathName, ignore); } for (std::string& i : ignore) { diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index ed90c76..8d5b177 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -505,9 +505,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) case cmPolicies::NEW: { // NEW behavior is to honor the <pkg>_ROOT variables. std::string const rootVar = this->Name + "_ROOT"; - if (const char* pkgRoot = this->Makefile->GetDefinition(rootVar)) { - cmExpandList(pkgRoot, rootPaths, false); - } + this->Makefile->GetDefExpandList(rootVar, rootPaths, false); cmSystemTools::GetPath(rootPaths, rootVar.c_str()); } break; } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index dcdaaea..250910a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1486,11 +1486,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths( } std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugSources = !this->DebugSourcesDone && cm::contains(debugProperties, "SOURCES"); @@ -3306,11 +3303,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories( nullptr, nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugIncludes = !this->DebugIncludesDone && cm::contains(debugProperties, "INCLUDE_DIRECTORIES"); @@ -3493,11 +3487,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions( nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugOptions = !this->DebugCompileOptionsDone && cm::contains(debugProperties, "COMPILE_OPTIONS"); @@ -3538,11 +3529,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures( nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugFeatures = !this->DebugCompileFeaturesDone && cm::contains(debugProperties, "COMPILE_FEATURES"); @@ -3585,11 +3573,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions( nullptr, nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugDefines = !this->DebugCompileDefinitionsDone && cm::contains(debugProperties, "COMPILE_DEFINITIONS"); @@ -3645,11 +3630,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders( nullptr, nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugDefines = !this->DebugPrecompileHeadersDone && std::find(debugProperties.begin(), debugProperties.end(), @@ -4024,11 +4006,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions( nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugOptions = !this->DebugLinkOptionsDone && cm::contains(debugProperties, "LINK_OPTIONS"); @@ -4286,11 +4265,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories( nullptr); std::vector<std::string> debugProperties; - const char* debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES", + debugProperties); bool debugDirectories = !this->DebugLinkDirectoriesDone && cm::contains(debugProperties, "LINK_DIRECTORIES"); @@ -5811,11 +5787,8 @@ void cmGeneratorTarget::ReportPropertyOrigin( const std::string& compatibilityType) const { std::vector<std::string> debugProperties; - const char* debugProp = this->Target->GetMakefile()->GetDefinition( - "CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) { - cmExpandList(debugProp, debugProperties); - } + this->Target->GetMakefile()->GetDefExpandList( + "CMAKE_DEBUG_TARGET_PROPERTIES", debugProperties); bool debugOrigin = !this->DebugCompatiblePropertiesDone[p] && cm::contains(debugProperties, p); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 68e25fb..4dc4092 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2524,9 +2524,8 @@ void cmGlobalGenerator::AddGlobalTarget_Test( cmCustomCommandLine singleLine; singleLine.push_back(cmSystemTools::GetCTestCommand()); singleLine.push_back("--force-new-ctest-process"); - if (auto testArgs = mf->GetDefinition("CMAKE_CTEST_ARGUMENTS")) { - std::vector<std::string> args; - cmExpandList(testArgs, args); + std::vector<std::string> args; + if (mf->GetDefExpandList("CMAKE_CTEST_ARGUMENTS", args)) { for (auto const& arg : args) { singleLine.push_back(arg); } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index cda3338..a5ce5d1 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3204,10 +3204,9 @@ std::string cmGlobalXCodeGenerator::GetObjectsDirectory( void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf) { this->Architectures.clear(); - const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES"); const char* sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT"); - if (osxArch && sysroot) { - cmExpandList(std::string(osxArch), this->Architectures); + if (sysroot) { + mf->GetDefExpandList("CMAKE_OSX_ARCHITECTURES", this->Architectures); } if (this->Architectures.empty()) { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 3130e6d..3fca2d4 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1236,11 +1236,10 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( // * Compilers like gfortran do not search their own implicit include // directories for modules ('.mod' files). if (lang != "Fortran") { - const char* value = this->Makefile->GetDefinition( - cmStrCat("CMAKE_", lang, "_IMPLICIT_INCLUDE_DIRECTORIES")); - if (value != nullptr) { - size_t const impDirVecOldSize = impDirVec.size(); - cmExpandList(value, impDirVec); + size_t const impDirVecOldSize = impDirVec.size(); + if (this->Makefile->GetDefExpandList( + cmStrCat("CMAKE_", lang, "_IMPLICIT_INCLUDE_DIRECTORIES"), + impDirVec)) { // FIXME: Use cmRange with 'advance()' when it supports non-const. for (size_t i = impDirVecOldSize; i < impDirVec.size(); ++i) { cmSystemTools::ConvertToUnixSlashes(impDirVec[i]); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 154da50..c527a49 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2745,6 +2745,18 @@ const std::string& cmMakefile::GetSafeDefinition(const std::string& name) const return *def; } +bool cmMakefile::GetDefExpandList(const std::string& name, + std::vector<std::string>& out, + bool emptyArgs) const +{ + cmProp def = this->GetDef(name); + if (!def) { + return false; + } + cmExpandList(*def, out, emptyArgs); + return true; +} + std::vector<std::string> cmMakefile::GetDefinitions() const { std::vector<std::string> res = this->StateSnapshot.ClosureKeys(); @@ -3273,10 +3285,7 @@ std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs, bool singleConfig) const { if (this->GetGlobalGenerator()->IsMultiConfig()) { - if (const char* configTypes = - this->GetDefinition("CMAKE_CONFIGURATION_TYPES")) { - cmExpandList(configTypes, configs); - } + this->GetDefExpandList("CMAKE_CONFIGURATION_TYPES", configs); return ""; } const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE"); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 5e418a3..8dfa5b0 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -512,6 +512,8 @@ public: const std::string& GetSafeDefinition(const std::string&) const; const std::string& GetRequiredDefinition(const std::string& name) const; bool IsDefinitionSet(const std::string&) const; + bool GetDefExpandList(const std::string& name, std::vector<std::string>& out, + bool emptyArgs = false) const; /** * Get the list of all variables in the current space. If argument * cacheonly is specified and is greater than 0, then only cache diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index e15b016..446f225 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -478,9 +478,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // add it now. std::string implibRuleVar = cmStrCat("CMAKE_", linkLanguage, "_CREATE_IMPORT_LIBRARY"); - if (const char* rule = this->Makefile->GetDefinition(implibRuleVar)) { - cmExpandList(rule, real_link_commands); - } + this->Makefile->GetDefExpandList(implibRuleVar, real_link_commands); } bool useResponseFileForObjects = diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 2d360e6..5809b4a 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -642,27 +642,21 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( arCreateVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable( arCreateVar, linkLanguage, this->GetConfigName()); - if (const char* rule = this->Makefile->GetDefinition(arCreateVar)) { - cmExpandList(rule, archiveCreateCommands); - } + this->Makefile->GetDefExpandList(arCreateVar, archiveCreateCommands); std::string arAppendVar = cmStrCat("CMAKE_", linkLanguage, "_ARCHIVE_APPEND"); arAppendVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable( arAppendVar, linkLanguage, this->GetConfigName()); - if (const char* rule = this->Makefile->GetDefinition(arAppendVar)) { - cmExpandList(rule, archiveAppendCommands); - } + this->Makefile->GetDefExpandList(arAppendVar, archiveAppendCommands); std::string arFinishVar = cmStrCat("CMAKE_", linkLanguage, "_ARCHIVE_FINISH"); arFinishVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable( arFinishVar, linkLanguage, this->GetConfigName()); - if (const char* rule = this->Makefile->GetDefinition(arFinishVar)) { - cmExpandList(rule, archiveFinishCommands); - } + this->Makefile->GetDefExpandList(arFinishVar, archiveFinishCommands); } // Decide whether to use archiving rules. diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 8f47010..b92548f 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -454,14 +454,12 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeDeviceLinkCmd() case cmStateEnums::STATIC_LIBRARY: case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: { - const std::string cudaLinkCmd( - this->GetMakefile()->GetDefinition("CMAKE_CUDA_DEVICE_LINK_LIBRARY")); - cmExpandList(cudaLinkCmd, linkCmds); + this->GetMakefile()->GetDefExpandList("CMAKE_CUDA_DEVICE_LINK_LIBRARY", + linkCmds); } break; case cmStateEnums::EXECUTABLE: { - const std::string cudaLinkCmd(this->GetMakefile()->GetDefinition( - "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE")); - cmExpandList(cudaLinkCmd, linkCmds); + this->GetMakefile()->GetDefExpandList( + "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE", linkCmds); } break; default: break; @@ -558,9 +556,8 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd( case cmStateEnums::EXECUTABLE: if (this->TargetLinkLanguage(config) == "Swift") { if (this->GeneratorTarget->IsExecutableWithExports()) { - const std::string flags = - this->Makefile->GetSafeDefinition("CMAKE_EXE_EXPORTS_Swift_FLAG"); - cmExpandList(flags, linkCmds); + this->Makefile->GetDefExpandList("CMAKE_EXE_EXPORTS_Swift_FLAG", + linkCmds); } } break; diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 4a93583..511a018 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -571,9 +571,8 @@ bool cmQtAutoGenInitializer::InitMoc() if (this->GenTarget->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") && (this->QtVersion >= IntegerVersion(5, 8))) { // Command - cmExpandList(this->Makefile->GetSafeDefinition( - "CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"), - this->Moc.PredefsCmd); + this->Makefile->GetDefExpandList("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND", + this->Moc.PredefsCmd); // Header if (!this->Moc.PredefsCmd.empty()) { ConfigFileNames(this->Moc.PredefsFile, diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 65d5f10..162e807 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2286,9 +2286,7 @@ int cmake::CheckBuildSystem() // If any byproduct of makefile generation is missing we must re-run. std::vector<std::string> products; - if (const char* productStr = mf.GetDefinition("CMAKE_MAKEFILE_PRODUCTS")) { - cmExpandList(productStr, products); - } + mf.GetDefExpandList("CMAKE_MAKEFILE_PRODUCTS", products); for (std::string const& p : products) { if (!(cmSystemTools::FileExists(p) || cmSystemTools::FileIsSymlink(p))) { if (verbose) { @@ -2303,11 +2301,8 @@ int cmake::CheckBuildSystem() // Get the set of dependencies and outputs. std::vector<std::string> depends; std::vector<std::string> outputs; - const char* dependsStr = mf.GetDefinition("CMAKE_MAKEFILE_DEPENDS"); - const char* outputsStr = mf.GetDefinition("CMAKE_MAKEFILE_OUTPUTS"); - if (dependsStr && outputsStr) { - cmExpandList(dependsStr, depends); - cmExpandList(outputsStr, outputs); + if (mf.GetDefExpandList("CMAKE_MAKEFILE_DEPENDS", depends)) { + mf.GetDefExpandList("CMAKE_MAKEFILE_OUTPUTS", outputs); } if (depends.empty() || outputs.empty()) { // Not enough information was provided to do the test. Just rerun. |