summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2020-05-30 12:00:00 (GMT)
committerVitaly Stakhovsky <vvs31415@gitlab.org>2020-05-30 12:59:20 (GMT)
commit7ed8c9ebe33ccafc41ec9e096bf2884d617a0ebf (patch)
treeb17167b762c3257baf362b515fbf1a8fece7b356
parent6bb20b51c9af40372b6a818826613e965cde5f19 (diff)
downloadCMake-7ed8c9ebe33ccafc41ec9e096bf2884d617a0ebf.zip
CMake-7ed8c9ebe33ccafc41ec9e096bf2884d617a0ebf.tar.gz
CMake-7ed8c9ebe33ccafc41ec9e096bf2884d617a0ebf.tar.bz2
cmMakefile: add GetDefExpandList() that splits value into std::vector
Combines cmMakefile:GetDefinition() and cmExpandList()
-rw-r--r--Source/cmComputeLinkInformation.cxx33
-rw-r--r--Source/cmDependsC.cxx4
-rw-r--r--Source/cmDependsFortran.cxx10
-rw-r--r--Source/cmFindCommon.cxx8
-rw-r--r--Source/cmFindPackageCommand.cxx4
-rw-r--r--Source/cmGeneratorTarget.cxx63
-rw-r--r--Source/cmGlobalGenerator.cxx5
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
-rw-r--r--Source/cmLocalGenerator.cxx9
-rw-r--r--Source/cmMakefile.cxx17
-rw-r--r--Source/cmMakefile.h2
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx12
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx15
-rw-r--r--Source/cmQtAutoGenInitializer.cxx5
-rw-r--r--Source/cmake.cxx11
16 files changed, 70 insertions, 137 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 8723d08..0ea73d6 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1330,18 +1330,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());
@@ -1554,10 +1549,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
@@ -1571,10 +1564,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());
@@ -1583,10 +1573,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) {
@@ -1598,10 +1585,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 d1517fe..6f3e1d3 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -504,9 +504,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 f2a51ab..f4372a1 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");
@@ -3305,11 +3302,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");
@@ -3492,11 +3486,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");
@@ -3537,11 +3528,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");
@@ -3584,11 +3572,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");
@@ -3644,11 +3629,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(),
@@ -4025,11 +4007,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");
@@ -4287,11 +4266,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");
@@ -5812,11 +5788,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 6f73b0c..5328a1c 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2507,9 +2507,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 ff05024..11620a5 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1235,11 +1235,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 04a1f2d..2cc2ce3 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -513,6 +513,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 f87eba7..72e6c2d 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -453,14 +453,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;
@@ -557,9 +555,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 003a300..4d7bab1 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -570,9 +570,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.