diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-08-01 19:00:00 (GMT) |
---|---|---|
committer | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-09-02 11:27:32 (GMT) |
commit | 11425041f04fd0945480b8f9e9933d1549b93981 (patch) | |
tree | 9cafffd6774513f686440b31795cbb3b5e38b65c /Source/cmStandardLevelResolver.cxx | |
parent | 99b21e58e020fedc6d09a619c1a8dc2e9ea7e2c5 (diff) | |
download | CMake-11425041f04fd0945480b8f9e9933d1549b93981.zip CMake-11425041f04fd0945480b8f9e9933d1549b93981.tar.gz CMake-11425041f04fd0945480b8f9e9933d1549b93981.tar.bz2 |
cmMakefile::GetDefinition: return cmProp
Diffstat (limited to 'Source/cmStandardLevelResolver.cxx')
-rw-r--r-- | Source/cmStandardLevelResolver.cxx | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx index 6dbab98..8672f61 100644 --- a/Source/cmStandardLevelResolver.cxx +++ b/Source/cmStandardLevelResolver.cxx @@ -63,7 +63,7 @@ struct StanardLevelComputer const auto& stds = this->Levels; const auto& stdsStrings = this->LevelsAsStrings; - const char* defaultStd = makefile->GetDefinition( + cmProp defaultStd = makefile->GetDefinition( cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT")); if (!cmNonempty(defaultStd)) { // this compiler has no notion of language standard levels @@ -93,8 +93,7 @@ struct StanardLevelComputer std::string option_flag = cmStrCat( "CMAKE_", this->Language, *standardProp, "_", type, "_COMPILE_OPTION"); - const char* opt = - target->Target->GetMakefile()->GetDefinition(option_flag); + cmProp opt = target->Target->GetMakefile()->GetDefinition(option_flag); if (!opt) { std::ostringstream e; e << "Target \"" << target->GetName() @@ -118,7 +117,7 @@ struct StanardLevelComputer int defaultValue = -1; try { standardValue = std::stoi(standardStr); - defaultValue = std::stoi(defaultStd); + defaultValue = std::stoi(*defaultStd); } catch (std::invalid_argument&) { // fall through as we want an error // when we can't find the bad value in the `stds` vector @@ -139,7 +138,7 @@ struct StanardLevelComputer if (defaultStdIt == cm::cend(stds)) { std::string e = cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT is set to invalid value '", - defaultStd, "'"); + *defaultStd, "'"); makefile->IssueMessage(MessageType::INTERNAL_ERROR, e); return std::string{}; } @@ -185,7 +184,7 @@ struct StanardLevelComputer cmProp existingStandard = currentLangStandardValue; if (existingStandard == nullptr) { - cmProp defaultStandard = makefile->GetDef( + cmProp defaultStandard = makefile->GetDefinition( cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT")); if (cmNonempty(defaultStandard)) { existingStandard = defaultStandard; @@ -228,7 +227,7 @@ struct StanardLevelComputer std::string const& config, std::string const& feature) const { - cmProp defaultStandard = makefile->GetDef( + cmProp defaultStandard = makefile->GetDefinition( cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT")); if (!defaultStandard) { makefile->IssueMessage( @@ -280,9 +279,9 @@ struct StanardLevelComputer std::string prefix = cmStrCat("CMAKE_", this->Language); StandardNeeded maxLevel = { -1, -1 }; for (size_t i = 0; i < this->Levels.size(); ++i) { - if (const char* prop = makefile->GetDefinition( + if (cmProp prop = makefile->GetDefinition( cmStrCat(prefix, this->LevelsAsStrings[i], "_COMPILE_FEATURES"))) { - std::vector<std::string> props = cmExpandedList(prop); + std::vector<std::string> props = cmExpandedList(*prop); if (cm::contains(props, feature)) { maxLevel = { static_cast<int>(i), this->Levels[i] }; } @@ -390,9 +389,10 @@ bool cmStandardLevelResolver::CheckCompileFeaturesAvailable( std::ostringstream e; e << "The compiler feature \"" << feature << "\" is not known to " << lang << " compiler\n\"" - << this->Makefile->GetDefinition("CMAKE_" + lang + "_COMPILER_ID") + << this->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID") << "\"\nversion " - << this->Makefile->GetDefinition("CMAKE_" + lang + "_COMPILER_VERSION") + << this->Makefile->GetSafeDefinition("CMAKE_" + lang + + "_COMPILER_VERSION") << "."; if (error) { *error = e.str(); @@ -469,7 +469,7 @@ const char* cmStandardLevelResolver::CompileFeaturesAvailable( return nullptr; } - const char* featuresKnown = + cmProp featuresKnown = this->Makefile->GetDefinition("CMAKE_" + lang + "_COMPILE_FEATURES"); if (!cmNonempty(featuresKnown)) { @@ -492,7 +492,7 @@ const char* cmStandardLevelResolver::CompileFeaturesAvailable( } return nullptr; } - return featuresKnown; + return cmToCStr(featuresKnown); } bool cmStandardLevelResolver::GetNewRequiredStandard( |