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

Method GetProperty

Source/cmSourceFile.cxx:401–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401cmValue cmSourceFile::GetProperty(std::string const& prop) const
402{
403 // Check for computed properties.
404 if (prop == propLOCATION) {
405 if (this->FullPath.empty()) {
406 return nullptr;
407 }
408 return cmValue(this->FullPath);
409 }
410
411 // Check for the properties with backtraces.
412 if (prop == propINCLUDE_DIRECTORIES) {
413 if (this->IncludeDirectories.empty()) {
414 return nullptr;
415 }
416
417 static std::string output;
418 output = cmList::to_string(this->IncludeDirectories);
419 return cmValue(output);
420 }
421
422 if (prop == propCOMPILE_OPTIONS) {
423 if (this->CompileOptions.empty()) {
424 return nullptr;
425 }
426
427 static std::string output;
428 output = cmList::to_string(this->CompileOptions);
429 return cmValue(output);
430 }
431
432 if (prop == propCOMPILE_DEFINITIONS) {
433 if (this->CompileDefinitions.empty()) {
434 return nullptr;
435 }
436
437 static std::string output;
438 output = cmList::to_string(this->CompileDefinitions);
439 return cmValue(output);
440 }
441
442 cmValue retVal = this->Properties.GetPropertyValue(prop);
443 if (!retVal) {
444 cmMakefile const* mf = this->Location.GetMakefile();
445 bool const chain =
446 mf->GetState()->IsPropertyChained(prop, cmProperty::SOURCE_FILE);
447 if (chain) {
448 return mf->GetProperty(prop, chain);
449 }
450 return nullptr;
451 }
452
453 return retVal;
454}
455
456std::string const& cmSourceFile::GetSafeProperty(std::string const& prop) const
457{

Callers 4

GetLanguageMethod · 0.95
GetPropertyForUserMethod · 0.95
GetPropertyAsBoolMethod · 0.95
cmSourceFile.cxxFile · 0.45

Calls 7

to_stringFunction · 0.85
GetPropertyValueMethod · 0.80
IsPropertyChainedMethod · 0.80
cmValueClass · 0.70
emptyMethod · 0.45
GetMakefileMethod · 0.45
GetStateMethod · 0.45

Tested by

no test coverage detected