diff options
author | Brad King <brad.king@kitware.com> | 2023-05-31 13:34:46 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-05-31 13:35:25 (GMT) |
commit | c4f273e722f76a62183265200a3dd18a50b1a60a (patch) | |
tree | f97b761f77deaf149d0302c84533e85d07de19ce /Source/cmMakefile.cxx | |
parent | 826825fe34df12e7e9b5d46a9df0011b0c70b1ba (diff) | |
parent | 4fc322bab421a83b12977aadc7dca247db8ae541 (diff) | |
download | CMake-c4f273e722f76a62183265200a3dd18a50b1a60a.zip CMake-c4f273e722f76a62183265200a3dd18a50b1a60a.tar.gz CMake-c4f273e722f76a62183265200a3dd18a50b1a60a.tar.bz2 |
Merge topic 'AddCacheEntry-suppress-raw-pointer-usage'
4fc322bab4 AddCacheEntry: Suppress raw pointer usage
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8520
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 92ba2d4..0af0ed0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2028,8 +2028,8 @@ void cmMakefile::AddDefinitionBool(const std::string& name, bool value) this->AddDefinition(name, value ? "ON" : "OFF"); } -void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, - const char* doc, +void cmMakefile::AddCacheDefinition(const std::string& name, cmValue value, + cmValue doc, cmStateEnums::CacheEntryType type, bool force) { @@ -2043,22 +2043,20 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, // if this is not a force, then use the value from the cache // if it is a force, then use the value being passed in if (!force) { - value = existingValue->c_str(); + value = existingValue; } if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) { - nvalue = value ? value : ""; - - cmList files(nvalue); + cmList files(value); for (auto& file : files) { if (!cmIsOff(file)) { file = cmSystemTools::CollapseFullPath(file); } } nvalue = files.to_string(); + value = cmValue{ nvalue }; - this->GetCMakeInstance()->AddCacheEntry(name, nvalue, doc, type); - nvalue = *this->GetState()->GetInitializedCacheValue(name); - value = nvalue.c_str(); + this->GetCMakeInstance()->AddCacheEntry(name, value, doc, type); + value = this->GetState()->GetInitializedCacheValue(name); } } this->GetCMakeInstance()->AddCacheEntry(name, value, doc, type); |