diff options
-rw-r--r-- | Source/cmCPluginAPI.cxx | 6 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 2 | ||||
-rw-r--r-- | Source/cmGetPropertyCommand.cxx | 13 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 9 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 4 | ||||
-rw-r--r-- | Source/cmProperty.h | 8 |
6 files changed, 16 insertions, 26 deletions
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index e922ee5..e460031 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -140,7 +140,7 @@ const char* CCONV cmGetCurrentOutputDirectory(void* arg) const char* CCONV cmGetDefinition(void* arg, const char* def) { cmMakefile* mf = static_cast<cmMakefile*>(arg); - return cmToCStr(mf->GetDefinition(def)); + return mf->GetDefinition(def).GetCStr(); } int CCONV cmIsOn(void* arg, const char* name) @@ -592,12 +592,12 @@ const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop) { cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg); if (cmSourceFile* rsf = sf->RealSourceFile) { - return cmToCStr(rsf->GetProperty(prop)); + return rsf->GetProperty(prop).GetCStr(); } if (!strcmp(prop, "LOCATION")) { return sf->FullPath.c_str(); } - return cmToCStr(sf->Properties.GetPropertyValue(prop)); + return sf->Properties.GetPropertyValue(prop).GetCStr(); } int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4bad7ab..d52dfaf 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5727,7 +5727,7 @@ const char* getTypedProperty<const char*>( cmProp value = tgt->GetProperty(prop); if (genexInterpreter == nullptr) { - return cmToCStr(value); + return value.GetCStr(); } return genexInterpreter->Evaluate(value ? *value : "", prop).c_str(); diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index c976dda..5f20075 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -34,10 +34,6 @@ enum OutType OutSet }; -// Implementation of result storage. -bool StoreResult(OutType infoType, cmMakefile& makefile, - const std::string& variable, const char* value); - // Implementation of each property type. bool HandleGlobalMode(cmExecutionStatus& status, const std::string& name, OutType infoType, const std::string& variable, @@ -255,8 +251,10 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args, namespace { +// Implementation of result storage. +template <typename ValueType> bool StoreResult(OutType infoType, cmMakefile& makefile, - const std::string& variable, const char* value) + const std::string& variable, ValueType value) { if (infoType == OutSet) { makefile.AddDefinition(variable, value ? "1" : "0"); @@ -270,10 +268,11 @@ bool StoreResult(OutType infoType, cmMakefile& makefile, } return true; } +template <> bool StoreResult(OutType infoType, cmMakefile& makefile, - const std::string& variable, cmProp value) + const std::string& variable, std::nullptr_t value) { - return StoreResult(infoType, makefile, variable, value.GetCStr()); + return StoreResult(infoType, makefile, variable, cmProp(value)); } bool HandleGlobalMode(cmExecutionStatus& status, const std::string& name, diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4c3e8ec..e2e0d8e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -856,19 +856,18 @@ std::string cmLocalGenerator::GetIncludeFlags( std::string const& includeFlag = this->Makefile->GetSafeDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_", lang)); - const char* sep = cmToCStr( - this->Makefile->GetDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_SEP_", lang))); bool quotePaths = false; if (this->Makefile->GetDefinition("CMAKE_QUOTE_INCLUDE_PATHS")) { quotePaths = true; } + std::string sep = " "; bool repeatFlag = true; // should the include flag be repeated like ie. -IA -IB - if (!sep) { - sep = " "; - } else { + if (cmProp incSep = this->Makefile->GetDefinition( + cmStrCat("CMAKE_INCLUDE_FLAG_SEP_", lang))) { // if there is a separator then the flag is not repeated but is only // given once i.e. -classpath a:b:c + sep = incSep; repeatFlag = false; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f9b2562..78c7246 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2453,7 +2453,7 @@ const char* cmMakefile::GetSONameFlag(const std::string& language) const name += language; } name += "_FLAG"; - return cmToCStr(this->GetDefinition(name)); + return this->GetDefinition(name).GetCStr(); } bool cmMakefile::CanIWriteThisFile(std::string const& fileName) const @@ -2531,7 +2531,7 @@ cmProp cmMakefile::GetDefinition(const std::string& name) const vv->VariableAccessed(name, def ? cmVariableWatch::VARIABLE_READ_ACCESS : cmVariableWatch::UNKNOWN_VARIABLE_READ_ACCESS, - cmToCStr(def), this); + def.GetCStr(), this); if (watch_function_executed) { // A callback was executed and may have caused re-allocation of the diff --git a/Source/cmProperty.h b/Source/cmProperty.h index 4179187..9d83df4 100644 --- a/Source/cmProperty.h +++ b/Source/cmProperty.h @@ -229,11 +229,3 @@ inline bool operator>=(cmProp l, std::nullptr_t) noexcept { return l.Compare(cmProp{}) >= 0; } - -/** - * Temporary wrapper - */ -inline const char* cmToCStr(cmProp p) -{ - return p.GetCStr(); -} |