diff options
author | Brad King <brad.king@kitware.com> | 2013-10-07 19:45:05 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-10-07 19:45:05 (GMT) |
commit | 4e1368c1a02e26464c94a5aa23a8ec3b27755775 (patch) | |
tree | 54dd177a444c2cd0289953745608073a2fa14351 /Source | |
parent | b38425fa4b15e4858f0b06bf75ba824550b87c34 (diff) | |
parent | a63fcbcb9f6c09294dfbeb8480be822f42529755 (diff) | |
download | CMake-4e1368c1a02e26464c94a5aa23a8ec3b27755775.zip CMake-4e1368c1a02e26464c94a5aa23a8ec3b27755775.tar.gz CMake-4e1368c1a02e26464c94a5aa23a8ec3b27755775.tar.bz2 |
Merge topic 'IMPORTED-target-SYSTEM-includes'
a63fcbc Always consider includes from IMPORTED targets to be SYSTEM.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmDocumentVariables.cxx | 8 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 32 |
2 files changed, 39 insertions, 1 deletions
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index fb2b3b9..c01a66e 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -1563,6 +1563,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm) false, "Variables that Control the Build"); cm->DefineProperty + ("CMAKE_NO_SYSTEM_FROM_IMPORTED", cmProperty::VARIABLE, + "Default value for NO_SYSTEM_FROM_IMPORTED of targets.", + "This variable is used to initialize the " + "NO_SYSTEM_FROM_IMPORTED property on all the targets. " + "See that target property for additional information.", + false, + "Variables that Control the Build"); + cm->DefineProperty ("CMAKE_<LANG>_VISIBILITY_PRESET", cmProperty::VARIABLE, "Default value for <LANG>_VISIBILITY_PRESET of targets.", "This variable is used to initialize the " diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 66f37b8..10b577f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -931,6 +931,17 @@ void cmTarget::DefineProperties(cmake *cm) false /* TODO: make this chained */ ); cm->DefineProperty + ("NO_SYSTEM_FROM_IMPORTED", cmProperty::TARGET, + "Do not treat includes from IMPORTED target interfaces as SYSTEM.", + "The contents of the INTERFACE_INCLUDE_DIRECTORIES of IMPORTED targets " + "are treated as SYSTEM includes by default. If this property is " + "enabled, the contents of the INTERFACE_INCLUDE_DIRECTORIES of IMPORTED " + "targets are not treated as system includes. " + "This property is initialized by the value of the variable " + "CMAKE_NO_SYSTEM_FROM_IMPORTED if it is set when a target is " + "created."); + + cm->DefineProperty ("OSX_ARCHITECTURES", cmProperty::TARGET, "Target specific architectures for OS X.", "The OSX_ARCHITECTURES property sets the target binary architecture " @@ -1640,6 +1651,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("WIN32_EXECUTABLE", 0); this->SetPropertyDefault("MACOSX_BUNDLE", 0); this->SetPropertyDefault("MACOSX_RPATH", 0); + this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0); // Collect the set of configuration types. @@ -2673,10 +2685,28 @@ void cmTarget::FinalizeSystemIncludeDirectories() ge.Parse(it->Value); std::string targetName = cge->Evaluate(this->Makefile, 0, false, this, 0, 0); - if (!this->Makefile->FindTargetToUse(targetName.c_str())) + cmTarget *tgt = this->Makefile->FindTargetToUse(targetName.c_str()); + if (!tgt) { continue; } + if (tgt->IsImported() + && tgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES") + && !this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED")) + { + std::string includeGenex = "$<TARGET_PROPERTY:" + + it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>"; + if (cmGeneratorExpression::Find(it->Value) != std::string::npos) + { + // Because it->Value is a generator expression, ensure that it + // evaluates to the non-empty string before being used in the + // TARGET_PROPERTY expression. + includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">"; + } + this->SystemIncludeDirectories.insert(includeGenex); + return; // The INTERFACE_SYSTEM_INCLUDE_DIRECTORIES are a subset + // of the INTERFACE_INCLUDE_DIRECTORIES + } } std::string includeGenex = "$<TARGET_PROPERTY:" + it->Value + ",INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>"; |