diff options
-rw-r--r-- | Source/cmExtraSublimeTextGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.cxx | 36 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmake.cxx | 5 | ||||
-rw-r--r-- | Source/cmake.h | 2 |
8 files changed, 35 insertions, 38 deletions
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 3e265a0..1c7e4b1 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -446,13 +446,13 @@ bool cmExtraSublimeTextGenerator::Open(const std::string& bindir, const std::string& projectName, bool dryRun) { - const char* sublExecutable = + cmProp sublExecutable = this->GlobalGenerator->GetCMakeInstance()->GetCacheDefinition( "CMAKE_SUBLIMETEXT_EXECUTABLE"); if (!sublExecutable) { return false; } - if (cmIsNOTFOUND(sublExecutable)) { + if (cmIsNOTFOUND(*sublExecutable)) { return false; } @@ -462,5 +462,5 @@ bool cmExtraSublimeTextGenerator::Open(const std::string& bindir, } return cmSystemTools::RunSingleCommand( - { sublExecutable, "--project", filename }); + { *sublExecutable, "--project", filename }); } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 86b01bc..46030e0 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -197,12 +197,12 @@ std::string cmGlobalGenerator::SelectMakeProgram( { std::string makeProgram = inMakeProgram; if (cmIsOff(makeProgram)) { - const char* makeProgramCSTR = + cmProp makeProgramCSTR = this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); if (cmIsOff(makeProgramCSTR)) { makeProgram = makeDefault; } else { - makeProgram = makeProgramCSTR; + makeProgram = *makeProgramCSTR; } if (cmIsOff(makeProgram) && !makeProgram.empty()) { makeProgram = "CMAKE_MAKE_PROGRAM-NOTFOUND"; @@ -2153,10 +2153,11 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator* gen, { this->SetConfiguredFilesPath(gen); this->TryCompileOuterMakefile = mf; - const char* make = + cmProp make = gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); - this->GetCMakeInstance()->AddCacheEntry( - "CMAKE_MAKE_PROGRAM", make, "make program", cmStateEnums::FILEPATH); + this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", cmToCStr(make), + "make program", + cmStateEnums::FILEPATH); // copy the enabled languages this->GetCMakeInstance()->GetState()->SetEnabledLanguages( gen->GetCMakeInstance()->GetState()->GetEnabledLanguages()); diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index cbaf0ab..c08c9cf 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -3,7 +3,6 @@ #include "cmGlobalGhsMultiGenerator.h" #include <algorithm> -#include <cstring> #include <map> #include <ostream> #include <utility> @@ -335,23 +334,23 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout, fout << "# Top Level Project File\n"; // Specify BSP option if supplied by user - const char* bspName = + cmProp bspName = this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); if (!cmIsOff(bspName)) { - fout << " -bsp " << bspName << '\n'; + fout << " -bsp " << *bspName << '\n'; } // Specify OS DIR if supplied by user // -- not all platforms require this entry in the project file if (!cmIsOff(this->OsDir)) { - const char* osDirOption = + cmProp osDirOption = this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION"); std::replace(this->OsDir.begin(), this->OsDir.end(), '\\', '/'); fout << " "; if (cmIsOff(osDirOption)) { fout << ""; } else { - fout << osDirOption; + fout << *osDirOption; } fout << "\"" << this->OsDir << "\"\n"; } @@ -565,9 +564,9 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand( { GeneratedMakeCommand makeCommand = {}; std::string gbuild; - if (const char* gbuildCached = + if (cmProp gbuildCached = this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM")) { - gbuild = gbuildCached; + gbuild = *gbuildCached; } makeCommand.Add(this->SelectMakeProgram(makeProgram, gbuild)); @@ -618,11 +617,10 @@ void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout, cmLocalGenerator* root) { fout << "macro PROJ_NAME=" << root->GetProjectName() << '\n'; - char const* ghsGpjMacros = + cmProp ghsGpjMacros = this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS"); - if (nullptr != ghsGpjMacros) { - std::vector<std::string> expandedList = - cmExpandedList(std::string(ghsGpjMacros)); + if (ghsGpjMacros) { + std::vector<std::string> expandedList = cmExpandedList(*ghsGpjMacros); for (std::string const& arg : expandedList) { fout << "macro " << arg << '\n'; } @@ -634,17 +632,17 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives( { /* set primary target */ std::string tgt; - const char* t = + cmProp t = this->GetCMakeInstance()->GetCacheDefinition("GHS_PRIMARY_TARGET"); if (cmNonempty(t)) { - tgt = t; + tgt = *t; this->GetCMakeInstance()->MarkCliAsUsed("GHS_PRIMARY_TARGET"); } else { - const char* a = + cmProp a = this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM"); - const char* p = + cmProp p = this->GetCMakeInstance()->GetCacheDefinition("GHS_TARGET_PLATFORM"); - tgt = cmStrCat((a ? a : ""), '_', (p ? p : ""), ".tgt"); + tgt = cmStrCat((a ? *a : ""), '_', (p ? *p : ""), ".tgt"); } /* clang-format off */ @@ -655,11 +653,11 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives( << "/CMakeFiles/custom_target.bod" << '\n'; /* clang-format on */ - char const* const customization = + cmProp const customization = this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); - if (nullptr != customization && strlen(customization) > 0) { + if (cmNonempty(customization)) { fout << "customization=" - << cmGlobalGhsMultiGenerator::TrimQuotes(customization) << '\n'; + << cmGlobalGhsMultiGenerator::TrimQuotes(*customization) << '\n'; this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION"); } } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 37a77fa..2c934e1 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -104,8 +104,8 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const cmStateEnums::INTERNAL); } } - const char* edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND"); - return edit_cmd ? edit_cmd : ""; + cmProp edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND"); + return edit_cmd ? *edit_cmd : std::string(); } void cmGlobalUnixMakefileGenerator3::ComputeTargetObjectDirectory( diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 84cfaeb..6267205 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -625,9 +625,9 @@ std::string cmGlobalVisualStudio7Generator::WriteUtilityDepend( std::string cmGlobalVisualStudio7Generator::GetGUID(std::string const& name) { std::string const& guidStoreName = name + "_GUID_CMAKE"; - if (const char* storedGUID = + if (cmProp storedGUID = this->CMakeInstance->GetCacheDefinition(guidStoreName)) { - return std::string(storedGUID); + return *storedGUID; } // Compute a GUID that is deterministic but unique to the build tree. std::string input = diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b57bdbc..b78f0a0 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3140,11 +3140,10 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name, const std::string& id) { std::string guidStoreName = cmStrCat(name, "_GUID_CMAKE"); - const char* storedGUID = - this->CMakeInstance->GetCacheDefinition(guidStoreName); + cmProp storedGUID = this->CMakeInstance->GetCacheDefinition(guidStoreName); if (storedGUID) { - return storedGUID; + return *storedGUID; } this->CMakeInstance->AddCacheEntry(guidStoreName, id.c_str(), diff --git a/Source/cmake.cxx b/Source/cmake.cxx index bca938e..014a707 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2000,10 +2000,9 @@ std::string cmake::StripExtension(const std::string& file) const return file; } -const char* cmake::GetCacheDefinition(const std::string& name) const +cmProp cmake::GetCacheDefinition(const std::string& name) const { - cmProp p = this->State->GetInitializedCacheValue(name); - return p ? p->c_str() : nullptr; + return this->State->GetInitializedCacheValue(name); } void cmake::AddScriptingCommands() diff --git a/Source/cmake.h b/Source/cmake.h index 44c35c2..63635cb 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -299,7 +299,7 @@ public: /** * Given a variable name, return its value (as a string). */ - const char* GetCacheDefinition(const std::string&) const; + cmProp GetCacheDefinition(const std::string&) const; //! Add an entry into the cache void AddCacheEntry(const std::string& key, const char* value, const char* helpString, int type); |