| 1350 | } |
| 1351 | |
| 1352 | bool 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 | |
| 1384 | void cmMakefile::InitializeFromParent(cmMakefile* parent) |
| 1385 | { |
no test coverage detected