diff options
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 98 |
1 files changed, 73 insertions, 25 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 717cfc8..52a2732 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -131,11 +131,13 @@ public: SourceEntriesType SourceEntries; struct IncludeDirectoriesEntry { - IncludeDirectoriesEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge) - : ge(cge) + IncludeDirectoriesEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge, + const std::string &targetName = std::string()) + : ge(cge), TargetName(targetName) {} const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge; std::vector<std::string> CachedIncludes; + const std::string TargetName; }; std::vector<IncludeDirectoriesEntry*> IncludeDirectoriesEntries; std::vector<cmValueWithOrigin> LinkInterfaceIncludeDirectoriesEntries; @@ -193,7 +195,8 @@ void cmTarget::DefineProperties(cmake *cm) "Should the target be processed with automoc (for Qt projects).", "AUTOMOC is a boolean specifying whether CMake will handle " "the Qt moc preprocessor automatically, i.e. without having to use " - "the QT4_WRAP_CPP() macro. Currently Qt4 is supported. " + "the QT4_WRAP_CPP() or QT5_WRAP_CPP() macro. Currently Qt4 and Qt5 are " + "supported. " "When this property is set to TRUE, CMake will scan the source files " "at build time and invoke moc accordingly. " "If an #include statement like #include \"moc_foo.cpp\" is found, " @@ -1232,7 +1235,9 @@ void cmTarget::DefineProperties(cmake *cm) ("GENERATOR_FILE_NAME", cmProperty::TARGET, "Generator's file for this target.", "An internal property used by some generators to record the name of " - "project or dsp file associated with this target."); + "project or dsp file associated with this target. Note that at configure " + "time, this property is only set for targets created by " + "include_external_msproject()."); cm->DefineProperty ("SOURCES", cmProperty::TARGET, @@ -2742,7 +2747,7 @@ void cmTarget::AppendBuildInterfaceIncludes() } this->BuildInterfaceIncludesAppended = true; - if (this->Makefile->IsOn("CMAKE_BUILD_INTERFACE_INCLUDES")) + if (this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE")) { const char *binDir = this->Makefile->GetStartOutputDirectory(); const char *srcDir = this->Makefile->GetStartDirectory(); @@ -2815,6 +2820,28 @@ static void processIncludeDirectories(cmTarget *tgt, for(std::vector<std::string>::iterator li = entryIncludes.begin(); li != entryIncludes.end(); ++li) { + cmTarget *dependentTarget = + mf->FindTargetToUse((*it)->TargetName.c_str()); + + const bool fromImported = dependentTarget + && dependentTarget->IsImported(); + + if (fromImported && !cmSystemTools::FileExists(li->c_str())) + { + cmOStringStream e; + e << "Imported target \"" << (*it)->TargetName << "\" includes " + "non-existent path\n \"" << *li << "\"\nin its " + "INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n" + "* The path was deleted, renamed, or moved to another " + "location.\n" + "* An install or uninstall procedure did not complete " + "successfully.\n" + "* The installation package was faulty and references files it " + "does not provide.\n"; + tgt->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + return; + } + if (testIsOff && !cmSystemTools::IsOff(li->c_str())) { cmSystemTools::ConvertToUnixSlashes(*li); @@ -2898,7 +2925,8 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config) ge.Parse(it->Value); std::string result = cge->Evaluate(this->Makefile, config, false, this, 0, 0); - if (!this->Makefile->FindTargetToUse(result.c_str())) + if (!cmGeneratorExpression::IsValidTargetName(result.c_str()) + || !this->Makefile->FindTargetToUse(result.c_str())) { continue; } @@ -2909,7 +2937,8 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config) it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>"); this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries.push_back( - new cmTargetInternals::IncludeDirectoriesEntry(cge)); + new cmTargetInternals::IncludeDirectoriesEntry(cge, + it->Value)); } } @@ -2938,29 +2967,33 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config) //---------------------------------------------------------------------------- std::string cmTarget::GetCompileDefinitions(const char *config) { - std::string defPropName = "COMPILE_DEFINITIONS"; + const char *configProp = 0; if (config) { - defPropName += "_" + cmSystemTools::UpperCase(config); + std::string configPropName; + configPropName = "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config); + configProp = this->GetProperty(configPropName.c_str()); } - const char *prop = this->GetProperty(defPropName.c_str()); + const char *noconfigProp = this->GetProperty("COMPILE_DEFINITIONS"); cmListFileBacktrace lfbt; cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(), - defPropName, 0, 0); + "COMPILE_DEFINITIONS", 0, 0); - std::string result; - if (prop) + std::string defsString = (noconfigProp ? noconfigProp : ""); + if (configProp && noconfigProp) { - cmGeneratorExpression ge(lfbt); - - result = ge.Parse(prop)->Evaluate(this->Makefile, - config, - false, - this, - &dagChecker); + defsString += ";"; } + defsString += (configProp ? configProp : ""); + + cmGeneratorExpression ge(lfbt); + std::string result = ge.Parse(defsString.c_str())->Evaluate(this->Makefile, + config, + false, + this, + &dagChecker); std::vector<std::string> libs; this->GetDirectLinkLibraries(config, libs, this); @@ -2975,7 +3008,9 @@ std::string cmTarget::GetCompileDefinitions(const char *config) for (std::vector<std::string>::const_iterator it = libs.begin(); it != libs.end(); ++it) { - if (this->Makefile->FindTargetToUse(it->c_str())) + if ((cmGeneratorExpression::IsValidTargetName(it->c_str()) + || cmGeneratorExpression::Find(it->c_str()) != std::string::npos) + && this->Makefile->FindTargetToUse(it->c_str())) { depString += sep + "$<TARGET_PROPERTY:" + *it + ",INTERFACE_COMPILE_DEFINITIONS>"; @@ -4253,10 +4288,15 @@ void cmTarget::SetPropertyDefault(const char* property, } //---------------------------------------------------------------------------- -bool cmTarget::HaveBuildTreeRPATH() +bool cmTarget::HaveBuildTreeRPATH(const char *config) { - return (!this->GetPropertyAsBool("SKIP_BUILD_RPATH") && - !this->LinkLibraries.empty()); + if (this->GetPropertyAsBool("SKIP_BUILD_RPATH")) + { + return false; + } + std::vector<std::string> libs; + this->GetDirectLinkLibraries(config, libs, this); + return !libs.empty(); } //---------------------------------------------------------------------------- @@ -4327,7 +4367,7 @@ bool cmTarget::NeedRelinkBeforeInstall(const char* config) // If either a build or install tree rpath is set then the rpath // will likely change between the build tree and install tree and // this target must be relinked. - return this->HaveBuildTreeRPATH() || this->HaveInstallTreeRPATH(); + return this->HaveBuildTreeRPATH(config) || this->HaveInstallTreeRPATH(); } //---------------------------------------------------------------------------- @@ -4743,6 +4783,10 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget *tgt, || (!impliedByUse && !explicitlySet)); cmComputeLinkInformation *info = tgt->GetLinkInformation(config); + if(!info) + { + return propContent; + } const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); bool propInitialized = explicitlySet; @@ -4883,6 +4927,10 @@ bool isLinkDependentProperty(cmTarget *tgt, const std::string &p, const char *config) { cmComputeLinkInformation *info = tgt->GetLinkInformation(config); + if(!info) + { + return false; + } const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); |