mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 13:20:47 -06:00
Add property to mark IMPORTED targets as not SYSTEM
Add an `IMPORTED_NO_SYSTEM` target property to specify this. When enabled, do not treat the `INTERFACE_INCLUDE_DIRECTORIES` of an imported target as `SYSTEM` include directories. This is similar to the existing `NO_SYSTEM_FROM_IMPORTED` property, but works from the consumed target rather than the consumer. Fixes: #17364
This commit is contained in:
@@ -239,6 +239,7 @@ Properties on Targets
|
|||||||
/prop_tgt/IMPORTED_LOCATION_CONFIG
|
/prop_tgt/IMPORTED_LOCATION_CONFIG
|
||||||
/prop_tgt/IMPORTED_NO_SONAME
|
/prop_tgt/IMPORTED_NO_SONAME
|
||||||
/prop_tgt/IMPORTED_NO_SONAME_CONFIG
|
/prop_tgt/IMPORTED_NO_SONAME_CONFIG
|
||||||
|
/prop_tgt/IMPORTED_NO_SYSTEM
|
||||||
/prop_tgt/IMPORTED_OBJECTS
|
/prop_tgt/IMPORTED_OBJECTS
|
||||||
/prop_tgt/IMPORTED_OBJECTS_CONFIG
|
/prop_tgt/IMPORTED_OBJECTS_CONFIG
|
||||||
/prop_tgt/IMPORTED_SONAME
|
/prop_tgt/IMPORTED_SONAME
|
||||||
|
|||||||
15
Help/prop_tgt/IMPORTED_NO_SYSTEM.rst
Normal file
15
Help/prop_tgt/IMPORTED_NO_SYSTEM.rst
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
IMPORTED_NO_SYSTEM
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Specifies that an :ref:`Imported Target <Imported Targets>` is not
|
||||||
|
a ``SYSTEM`` library. This has the following effects:
|
||||||
|
|
||||||
|
* Entries of :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` are not treated
|
||||||
|
as ``SYSTEM`` include directories when compiling consumers, as they
|
||||||
|
would be by default.
|
||||||
|
|
||||||
|
Ignored for non-imported targets.
|
||||||
|
|
||||||
|
See the :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` target property to set this
|
||||||
|
behavior on the target consuming the include directories rather than
|
||||||
|
providing them.
|
||||||
@@ -13,3 +13,6 @@ imported targets as system includes.
|
|||||||
This property is initialized by the value of the
|
This property is initialized by the value of the
|
||||||
:variable:`CMAKE_NO_SYSTEM_FROM_IMPORTED` variable if it is set when a target
|
:variable:`CMAKE_NO_SYSTEM_FROM_IMPORTED` variable if it is set when a target
|
||||||
is created.
|
is created.
|
||||||
|
|
||||||
|
See the :prop_tgt:`IMPORTED_NO_SYSTEM` target property to set this behavior
|
||||||
|
on the target providing the include directories rather than consuming them.
|
||||||
|
|||||||
7
Help/release/dev/imported-no-system.rst
Normal file
7
Help/release/dev/imported-no-system.rst
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
imported-no-system
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* The :prop_tgt:`IMPORTED_NO_SYSTEM` target property was added to
|
||||||
|
specify that an :ref:`Imported Target <Imported Targets>` should
|
||||||
|
not be treated as a system library (i.e. its include directories
|
||||||
|
are not automatically ``SYSTEM``).
|
||||||
@@ -747,6 +747,9 @@ void handleSystemIncludesDep(cmLocalGenerator* lg,
|
|||||||
if (!depTgt->IsImported() || excludeImported) {
|
if (!depTgt->IsImported() || excludeImported) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (depTgt->GetPropertyAsBool("IMPORTED_NO_SYSTEM")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (cmValue dirs = depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) {
|
if (cmValue dirs = depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) {
|
||||||
cmExpandList(cmGeneratorExpression::Evaluate(*dirs, lg, config, headTarget,
|
cmExpandList(cmGeneratorExpression::Evaluate(*dirs, lg, config, headTarget,
|
||||||
|
|||||||
@@ -115,6 +115,13 @@ add_library(ordertest ordertest.cpp)
|
|||||||
target_include_directories(ordertest SYSTEM PUBLIC SystemIncludeDirectories/systemlib)
|
target_include_directories(ordertest SYSTEM PUBLIC SystemIncludeDirectories/systemlib)
|
||||||
target_include_directories(ordertest PUBLIC SystemIncludeDirectories/userlib)
|
target_include_directories(ordertest PUBLIC SystemIncludeDirectories/userlib)
|
||||||
|
|
||||||
|
add_library(ordertest2 ordertest.cpp)
|
||||||
|
target_include_directories(ordertest2 SYSTEM PRIVATE SystemIncludeDirectories/systemlib)
|
||||||
|
target_link_libraries(ordertest2 PRIVATE ordertest2_userlib)
|
||||||
|
add_library(ordertest2_userlib INTERFACE IMPORTED)
|
||||||
|
target_include_directories(ordertest2_userlib INTERFACE SystemIncludeDirectories/userlib)
|
||||||
|
set_property(TARGET ordertest2_userlib PROPERTY IMPORTED_NO_SYSTEM 1)
|
||||||
|
|
||||||
add_subdirectory(StandardIncludeDirectories)
|
add_subdirectory(StandardIncludeDirectories)
|
||||||
add_subdirectory(TargetIncludeDirectories)
|
add_subdirectory(TargetIncludeDirectories)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user