1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

Allow NO_SYSTEM_FROM_IMPORTED on imported INTERFACE libraries

Imported INTERFACE libraries can specify include directories via
`INTERFACE_INCLUDE_DIRECTORIES` so the default behavior of treating them
as system include directories applies.  Allow users to turn this off by
setting `NO_SYSTEM_FROM_IMPORTED` on such targets.

Closes: #16443
This commit is contained in:
Brad King
2016-11-21 10:42:24 -05:00
parent acde2c4a53
commit 460052516f
5 changed files with 12 additions and 1 deletions

View File

@@ -964,6 +964,7 @@ are:
* ``EXPORT_NAME``
* ``IMPORTED``
* ``NAME``
* ``NO_SYSTEM_FROM_IMPORTED``
* Properties matching ``IMPORTED_LIBNAME_*``
* Properties matching ``MAP_IMPORTED_CONFIG_*``

View File

@@ -0,0 +1,5 @@
imported-interface-no-system
----------------------------
* The :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` target property is now supported
on :ref:`Imported <Imported Targets>` :ref:`Interface Libraries`.

View File

@@ -253,7 +253,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->SetPropertyDefault("WIN32_EXECUTABLE", CM_NULLPTR);
this->SetPropertyDefault("MACOSX_BUNDLE", CM_NULLPTR);
this->SetPropertyDefault("MACOSX_RPATH", CM_NULLPTR);
this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", CM_NULLPTR);
this->SetPropertyDefault("C_CLANG_TIDY", CM_NULLPTR);
this->SetPropertyDefault("C_COMPILER_LAUNCHER", CM_NULLPTR);
this->SetPropertyDefault("C_INCLUDE_WHAT_YOU_USE", CM_NULLPTR);
@@ -271,6 +270,10 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->SetPropertyDefault("LINK_SEARCH_END_STATIC", CM_NULLPTR);
}
if (this->GetType() != cmStateEnums::UTILITY) {
this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", CM_NULLPTR);
}
// Collect the set of configuration types.
std::vector<std::string> configNames;
mf->GetConfigurations(configNames);

View File

@@ -66,6 +66,7 @@ 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;

View File

@@ -64,6 +64,7 @@ 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