summaryrefslogtreecommitdiffstats
path: root/Source/cmCPluginAPI.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2023-05-28 14:27:03 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2023-05-30 14:41:59 (GMT)
commit4fc322bab421a83b12977aadc7dca247db8ae541 (patch)
tree3e57b548bd2326f3a848eb23ad66da33d28f60b5 /Source/cmCPluginAPI.cxx
parentb0d1ddb7234950374977b83f8dbded806c15b356 (diff)
downloadCMake-4fc322bab421a83b12977aadc7dca247db8ae541.zip
CMake-4fc322bab421a83b12977aadc7dca247db8ae541.tar.gz
CMake-4fc322bab421a83b12977aadc7dca247db8ae541.tar.bz2
AddCacheEntry: Suppress raw pointer usage
Diffstat (limited to 'Source/cmCPluginAPI.cxx')
-rw-r--r--Source/cmCPluginAPI.cxx25
1 files changed, 19 insertions, 6 deletions
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index c2c5bdb..13ccf4f 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -14,6 +14,7 @@
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmValue.h"
#include "cmVersion.h"
#ifdef __QNX__
@@ -78,25 +79,37 @@ static void CCONV cmAddCacheDefinition(void* arg, const char* name,
int type)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
+ std::string valueString;
+ std::string docString;
+ cmValue v;
+ cmValue d;
+ if (value != nullptr) {
+ valueString = value;
+ v = cmValue{ valueString };
+ }
+ if (doc != nullptr) {
+ docString = doc;
+ d = cmValue{ docString };
+ }
switch (type) {
case CM_CACHE_BOOL:
- mf->AddCacheDefinition(name, value, doc, cmStateEnums::BOOL);
+ mf->AddCacheDefinition(name, v, d, cmStateEnums::BOOL);
break;
case CM_CACHE_PATH:
- mf->AddCacheDefinition(name, value, doc, cmStateEnums::PATH);
+ mf->AddCacheDefinition(name, v, d, cmStateEnums::PATH);
break;
case CM_CACHE_FILEPATH:
- mf->AddCacheDefinition(name, value, doc, cmStateEnums::FILEPATH);
+ mf->AddCacheDefinition(name, v, d, cmStateEnums::FILEPATH);
break;
case CM_CACHE_STRING:
- mf->AddCacheDefinition(name, value, doc, cmStateEnums::STRING);
+ mf->AddCacheDefinition(name, v, d, cmStateEnums::STRING);
break;
case CM_CACHE_INTERNAL:
- mf->AddCacheDefinition(name, value, doc, cmStateEnums::INTERNAL);
+ mf->AddCacheDefinition(name, v, d, cmStateEnums::INTERNAL);
break;
case CM_CACHE_STATIC:
- mf->AddCacheDefinition(name, value, doc, cmStateEnums::STATIC);
+ mf->AddCacheDefinition(name, v, d, cmStateEnums::STATIC);
break;
}
}