MCPcopy Create free account
hub / github.com/Kitware/CMake / ParseDefineFlag

Method ParseDefineFlag

Source/cmMakefile.cxx:1352–1382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1350}
1351
1352bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
1353{
1354 // Create a regular expression to match valid definitions.
1355 static cmsys::RegularExpression valid("^[-/]D[A-Za-z_][A-Za-z0-9_]*(=.*)?$");
1356
1357 // Make sure the definition matches.
1358 if (!valid.find(def)) {
1359 return false;
1360 }
1361
1362 // Get the definition part after the flag.
1363 char const* define = def.c_str() + 2;
1364
1365 if (remove) {
1366 if (cmValue cdefs = this->GetProperty("COMPILE_DEFINITIONS")) {
1367 // Expand the list.
1368 cmList defs{ *cdefs };
1369
1370 // Recompose the list without the definition.
1371 defs.remove_items({ define });
1372
1373 // Store the new list.
1374 this->SetProperty("COMPILE_DEFINITIONS", defs.to_string());
1375 }
1376 } else {
1377 // Append the definition to the directory property.
1378 this->AppendProperty("COMPILE_DEFINITIONS", define);
1379 }
1380
1381 return true;
1382}
1383
1384void cmMakefile::InitializeFromParent(cmMakefile* parent)
1385{

Callers 2

AddDefineFlagMethod · 0.95
RemoveDefineFlagMethod · 0.95

Calls 6

GetPropertyMethod · 0.95
SetPropertyMethod · 0.95
AppendPropertyMethod · 0.95
c_strMethod · 0.80
to_stringMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected