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

Function AddCompileFeature

Source/cmPackageInfoReader.cxx:315–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315void AddCompileFeature(cmMakefile* makefile, cmTarget* target,
316 cm::string_view configuration, std::string const& value)
317{
318 auto reLanguageLevel = []() -> cmsys::RegularExpression {
319 static cmsys::RegularExpression re{ "^[Cc]([+][+])?([0-9][0-9])$" };
320 return re;
321 }();
322
323 if (reLanguageLevel.find(value)) {
324 std::string::size_type const n = reLanguageLevel.end() - 2;
325 cm::string_view const featurePrefix = (n == 3 ? "cxx_std_"_s : "c_std_"_s);
326 if (configuration.empty()) {
327 AppendProperty(makefile, target, "COMPILE_FEATURES"_s, {},
328 cmStrCat(featurePrefix, value.substr(n)));
329 } else {
330 std::string const& feature =
331 cmStrCat("$<$<CONFIG:"_s, configuration, ">:"_s, featurePrefix,
332 value.substr(n), '>');
333 AppendProperty(makefile, target, "COMPILE_FEATURES"_s, {}, feature);
334 }
335 } else if (cmStrCaseEq(value, "gnu"_s)) {
336 // Not implemented in CMake at this time
337 } else if (cmStrCaseEq(value, "threads"_s)) {
338 AppendProperty(makefile, target, "LINK_LIBRARIES"_s, configuration,
339 "Threads::Threads");
340 }
341}
342
343void AddLinkFeature(cmMakefile* makefile, cmTarget* target,
344 cm::string_view configuration, std::string const& value)

Callers 1

SetTargetPropertiesMethod · 0.85

Calls 7

AppendPropertyFunction · 0.85
cmStrCaseEqFunction · 0.85
cmStrCatFunction · 0.70
findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…