summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-10-13 14:36:45 -0400
committerBrad King <brad.king@kitware.com>2017-10-13 14:36:45 -0400
commitf64c554cc9d196f3c1f81a532e4a429b2a180943 (patch)
tree3bf44bd7c5d6f086ce0542d68727a57e15911d01
parent4d04ede10c451ce9a53e8bc34e0d64ab167ad9f9 (diff)
parent22beb07f9871338c3cdc1ce47bf1da0433519547 (diff)
downloadcmake-f64c554cc9d196f3c1f81a532e4a429b2a180943.tar.gz
Merge branch 'imported-interface-no-system' into release-3.10
Merge-request: !1386
-rw-r--r--Help/manual/cmake-buildsystem.7.rst4
-rw-r--r--Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst18
-rw-r--r--Source/cmTarget.cxx5
-rw-r--r--Source/cmTargetPropertyComputer.cxx9
-rw-r--r--Tests/InterfaceLibrary/CMakeLists.txt1
5 files changed, 22 insertions, 15 deletions
diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst
index debaf23100..ae538edc2d 100644
--- a/Help/manual/cmake-buildsystem.7.rst
+++ b/Help/manual/cmake-buildsystem.7.rst
@@ -687,7 +687,8 @@ property are treated as ``SYSTEM`` include directories, as if they were
listed in the :prop_tgt:`INTERFACE_SYSTEM_INCLUDE_DIRECTORIES` of the
dependency. This can result in omission of compiler warnings for headers
found in those directories. This behavior for :ref:`imported targets` may
-be controlled with the :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` target property.
+be controlled by setting the :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` target
+property on the *consumers* of imported targets.
If a binary target is linked transitively to a Mac OX framework, the
``Headers`` directory of the framework is also treated as a usage requirement.
@@ -970,7 +971,6 @@ are:
* ``EXPORT_NAME``
* ``IMPORTED``
* ``NAME``
-* ``NO_SYSTEM_FROM_IMPORTED``
* Properties matching ``IMPORTED_LIBNAME_*``
* Properties matching ``MAP_IMPORTED_CONFIG_*``
diff --git a/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst b/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst
index 070dd3018b..880343de4b 100644
--- a/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst
+++ b/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst
@@ -1,11 +1,15 @@
NO_SYSTEM_FROM_IMPORTED
-----------------------
-Do not treat includes from IMPORTED target interfaces as SYSTEM.
+Do not treat include directories from the interfaces of consumed
+:ref:`imported targets` 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.
+The contents of the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target property
+of imported targets are treated as ``SYSTEM`` includes by default. If this
+property is enabled on a target, compilation of sources in that target will
+not treat the contents of the ``INTERFACE_INCLUDE_DIRECTORIES`` of consumed
+imported targets as system includes.
+
+This property is initialized by the value of the
+:variable:`CMAKE_NO_SYSTEM_FROM_IMPORTED` variable if it is set when a target
+is created.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 7a3cc76dd3..c6cd5026f1 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -256,6 +256,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->SetPropertyDefault("WIN32_EXECUTABLE", nullptr);
this->SetPropertyDefault("MACOSX_BUNDLE", nullptr);
this->SetPropertyDefault("MACOSX_RPATH", nullptr);
+ this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", nullptr);
this->SetPropertyDefault("BUILD_WITH_INSTALL_NAME_DIR", nullptr);
this->SetPropertyDefault("C_CLANG_TIDY", nullptr);
this->SetPropertyDefault("C_COMPILER_LAUNCHER", nullptr);
@@ -282,10 +283,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->SetPropertyDefault("LINK_SEARCH_END_STATIC", nullptr);
}
- if (this->GetType() != cmStateEnums::UTILITY) {
- this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", nullptr);
- }
-
// Collect the set of configuration types.
std::vector<std::string> configNames;
mf->GetConfigurations(configNames);
diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx
index 3a3c165be6..1d2520d4b8 100644
--- a/Source/cmTargetPropertyComputer.cxx
+++ b/Source/cmTargetPropertyComputer.cxx
@@ -66,12 +66,19 @@ bool cmTargetPropertyComputer::WhiteListedInterfaceProperty(
}
if (prop == "IMPORTED_CONFIGURATIONS" || prop == "IMPORTED_LIBNAME" ||
- prop == "NO_SYSTEM_FROM_IMPORTED" ||
cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME_") ||
cmHasLiteralPrefix(prop, "MAP_IMPORTED_CONFIG_")) {
return true;
}
+ // This property should not be allowed but was incorrectly added in
+ // CMake 3.8. We can't remove it from the whitelist without breaking
+ // projects that try to set it. One day we could warn about this, but
+ // for now silently accept it.
+ if (prop == "NO_SYSTEM_FROM_IMPORTED") {
+ return true;
+ }
+
return false;
}
diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt
index 33c4b9073b..3db210a5de 100644
--- a/Tests/InterfaceLibrary/CMakeLists.txt
+++ b/Tests/InterfaceLibrary/CMakeLists.txt
@@ -64,7 +64,6 @@ target_link_libraries(iface_whitelist INTERFACE $<$<BOOL:$<TARGET_PROPERTY:CUSTO
add_executable(exec_whitelist dummy.cpp)
target_link_libraries(exec_whitelist iface_whitelist)
-set(CMAKE_NO_SYSTEM_FROM_IMPORTED 1)
add_library(iface_imported INTERFACE IMPORTED)
set_property(TARGET iface_imported PROPERTY
INTERFACE_COMPILE_DEFINITIONS