summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2020-08-01 19:00:00 (GMT)
committerVitaly Stakhovsky <vvs31415@gitlab.org>2020-09-02 11:27:32 (GMT)
commit11425041f04fd0945480b8f9e9933d1549b93981 (patch)
tree9cafffd6774513f686440b31795cbb3b5e38b65c /Source/cmGlobalGenerator.cxx
parent99b21e58e020fedc6d09a619c1a8dc2e9ea7e2c5 (diff)
downloadCMake-11425041f04fd0945480b8f9e9933d1549b93981.zip
CMake-11425041f04fd0945480b8f9e9933d1549b93981.tar.gz
CMake-11425041f04fd0945480b8f9e9933d1549b93981.tar.bz2
cmMakefile::GetDefinition: return cmProp
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx54
1 files changed, 26 insertions, 28 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index a550b50..74360b8 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -780,27 +780,27 @@ void cmGlobalGenerator::EnableLanguage(
std::string compilerName = cmStrCat("CMAKE_", lang, "_COMPILER");
std::string compilerEnv = cmStrCat("CMAKE_", lang, "_COMPILER_ENV_VAR");
std::ostringstream noCompiler;
- const char* compilerFile = mf->GetDefinition(compilerName);
- if (!cmNonempty(compilerFile) || cmIsNOTFOUND(compilerFile)) {
+ cmProp compilerFile = mf->GetDefinition(compilerName);
+ if (!cmNonempty(compilerFile) || cmIsNOTFOUND(*compilerFile)) {
/* clang-format off */
noCompiler <<
"No " << compilerName << " could be found.\n"
;
/* clang-format on */
} else if ((lang != "RC") && (lang != "ASM_MASM")) {
- if (!cmSystemTools::FileIsFullPath(compilerFile)) {
+ if (!cmSystemTools::FileIsFullPath(*compilerFile)) {
/* clang-format off */
noCompiler <<
"The " << compilerName << ":\n"
- " " << compilerFile << "\n"
+ " " << *compilerFile << "\n"
"is not a full path and was not found in the PATH.\n"
;
/* clang-format on */
- } else if (!cmSystemTools::FileExists(compilerFile)) {
+ } else if (!cmSystemTools::FileExists(*compilerFile)) {
/* clang-format off */
noCompiler <<
"The " << compilerName << ":\n"
- " " << compilerFile << "\n"
+ " " << *compilerFile << "\n"
"is not a full path to an existing compiler tool.\n"
;
/* clang-format on */
@@ -817,7 +817,7 @@ void cmGlobalGenerator::EnableLanguage(
cmSystemTools::RemoveFile(compilerLangFile);
if (!this->CMakeInstance->GetIsInTryCompile()) {
this->PrintCompilerAdvice(noCompiler, lang,
- mf->GetDefinition(compilerEnv));
+ cmToCStr(mf->GetDefinition(compilerEnv)));
mf->IssueMessage(MessageType::FATAL_ERROR, noCompiler.str());
fatalError = true;
}
@@ -1095,17 +1095,16 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
return;
}
- std::string linkerPrefVar =
- std::string("CMAKE_") + std::string(l) + std::string("_LINKER_PREFERENCE");
- const char* linkerPref = mf->GetDefinition(linkerPrefVar);
+ std::string linkerPrefVar = "CMAKE_" + l + "_LINKER_PREFERENCE";
+ cmProp linkerPref = mf->GetDefinition(linkerPrefVar);
int preference = 0;
- if (linkerPref) {
- if (sscanf(linkerPref, "%d", &preference) != 1) {
+ if (cmNonempty(linkerPref)) {
+ if (sscanf(linkerPref->c_str(), "%d", &preference) != 1) {
// backward compatibility: before 2.6 LINKER_PREFERENCE
// was either "None" or "Preferred", and only the first character was
// tested. So if there is a custom language out there and it is
// "Preferred", set its preference high
- if (linkerPref[0] == 'P') {
+ if ((*linkerPref)[0] == 'P') {
preference = 100;
} else {
preference = 0;
@@ -1122,14 +1121,14 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
this->LanguageToLinkerPreference[l] = preference;
- std::string outputExtensionVar =
- std::string("CMAKE_") + std::string(l) + std::string("_OUTPUT_EXTENSION");
- const char* outputExtension = mf->GetDefinition(outputExtensionVar);
- if (outputExtension) {
+ std::string outputExtensionVar = "CMAKE_" + l + "_OUTPUT_EXTENSION";
+ if (cmProp p = mf->GetDefinition(outputExtensionVar)) {
+ std::string outputExtension = *p;
this->LanguageToOutputExtension[l] = outputExtension;
this->OutputExtensions[outputExtension] = outputExtension;
- if (outputExtension[0] == '.') {
- this->OutputExtensions[outputExtension + 1] = outputExtension + 1;
+ if (cmHasPrefix(outputExtension, ".")) {
+ outputExtension = outputExtension.substr(1);
+ this->OutputExtensions[outputExtension] = outputExtension;
}
}
@@ -1162,7 +1161,7 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l,
const char* cmGlobalGenerator::GetGlobalSetting(std::string const& name) const
{
assert(!this->Makefiles.empty());
- return this->Makefiles[0]->GetDefinition(name);
+ return cmToCStr(this->Makefiles[0]->GetDefinition(name));
}
bool cmGlobalGenerator::GlobalSettingIsOn(std::string const& name) const
@@ -2463,9 +2462,9 @@ void cmGlobalGenerator::AddGlobalTarget_Package(
if (this->GetPreinstallTargetName()) {
gti.Depends.emplace_back(this->GetPreinstallTargetName());
} else {
- const char* noPackageAll =
+ cmProp noPackageAll =
mf->GetDefinition("CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY");
- if (!noPackageAll || cmIsOff(noPackageAll)) {
+ if (cmIsOff(noPackageAll)) {
gti.Depends.emplace_back(this->GetAllTargetName());
}
}
@@ -2644,9 +2643,8 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
if (this->GetPreinstallTargetName()) {
gti.Depends.emplace_back(this->GetPreinstallTargetName());
} else {
- const char* noall =
- mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
- if (!noall || cmIsOff(noall)) {
+ cmProp noall = mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
+ if (cmIsOff(noall)) {
gti.Depends.emplace_back(this->GetAllTargetName());
}
}
@@ -2666,7 +2664,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
singleLine.push_back(cfgArg);
cfgArg = "-DEFFECTIVE_PLATFORM_NAME=$(EFFECTIVE_PLATFORM_NAME)";
} else {
- cfgArg += mf->GetDefinition("CMAKE_CFG_INTDIR");
+ cfgArg += cmToCStr(mf->GetDefinition("CMAKE_CFG_INTDIR"));
}
singleLine.push_back(cfgArg);
}
@@ -3074,7 +3072,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
cmProp targetLabels = target->GetProperty("LABELS");
cmProp directoryLabels =
target->Target->GetMakefile()->GetProperty("LABELS");
- const char* cmakeDirectoryLabels =
+ cmProp cmakeDirectoryLabels =
target->Target->GetMakefile()->GetDefinition("CMAKE_DIRECTORY_LABELS");
if (targetLabels || directoryLabels || cmakeDirectoryLabels) {
Json::Value lj_root(Json::objectValue);
@@ -3110,7 +3108,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
}
if (cmakeDirectoryLabels) {
- cmExpandList(cmakeDirectoryLabels, cmakeDirectoryLabelsList);
+ cmExpandList(*cmakeDirectoryLabels, cmakeDirectoryLabelsList);
}
if (!directoryLabelsList.empty() || !cmakeDirectoryLabelsList.empty()) {