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

Method PopulateIncludeDirectoriesInterface

Source/cmExportInstallFileGenerator.cxx:555–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

553}
554
555void cmExportInstallFileGenerator::PopulateIncludeDirectoriesInterface(
556 cmGeneratorTarget const* target,
557 cmGeneratorExpression::PreprocessContext preprocessRule,
558 ImportPropertyMap& properties, cmTargetExport const& te,
559 std::string& includesDestinationDirs)
560{
561 assert(preprocessRule == cmGeneratorExpression::InstallInterface);
562
563 includesDestinationDirs.clear();
564
565 char const* const propName = "INTERFACE_INCLUDE_DIRECTORIES";
566 cmValue input = target->GetProperty(propName);
567
568 cmGeneratorExpression ge(*target->Makefile->GetCMakeInstance());
569
570 std::string dirs = cmGeneratorExpression::Preprocess(
571 cmList::to_string(target->Target->GetInstallIncludeDirectoriesEntries(te)),
572 preprocessRule, this->GetImportPrefixWithSlash());
573 this->ReplaceInstallPrefix(dirs);
574 std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
575 std::string exportDirs =
576 cge->Evaluate(target->GetLocalGenerator(), "", target);
577
578 if (cge->GetHadContextSensitiveCondition()) {
579 cmLocalGenerator* lg = target->GetLocalGenerator();
580 std::ostringstream e;
581 e << "Target \"" << target->GetName()
582 << "\" is installed with "
583 "INCLUDES DESTINATION set to a context sensitive path. Paths which "
584 "depend on the configuration, policy values or the link interface "
585 "are "
586 "not supported. Consider using target_include_directories instead.";
587 lg->IssueMessage(MessageType::FATAL_ERROR, e.str());
588 return;
589 }
590
591 if (!input && exportDirs.empty()) {
592 return;
593 }
594 if ((input && input->empty()) && exportDirs.empty()) {
595 // Set to empty
596 properties[propName].clear();
597 return;
598 }
599
600 this->AddImportPrefix(exportDirs);
601 includesDestinationDirs = exportDirs;
602
603 std::string includes = (input ? *input : "");
604 char const* const sep = input ? ";" : "";
605 includes += sep + exportDirs;
606 std::string prepro = cmGeneratorExpression::Preprocess(
607 includes, preprocessRule, this->GetImportPrefixWithSlash());
608 if (!prepro.empty()) {
609 this->ResolveTargetsInGeneratorExpressions(prepro, target);
610
611 if (!this->CheckInterfaceDirs(prepro, target, propName)) {
612 return;

Callers 1

Calls 15

ReplaceInstallPrefixMethod · 0.95
CheckInterfaceDirsMethod · 0.95
to_stringFunction · 0.85
strMethod · 0.80
AddImportPrefixMethod · 0.80
clearMethod · 0.45
GetPropertyMethod · 0.45
GetCMakeInstanceMethod · 0.45
ParseMethod · 0.45

Tested by

no test coverage detected