Merge topic 'INTERFACE_SYSTEM_INCLUDE_DIRECTORIES-update'
85857e6d
Help: Clarify INTERFACE_SYSTEM_INCLUDE_DIRECTORIES documentation.ee38062b
IncludeDirectories: Respect SYSTEM flag when using CONFIG genex.
This commit is contained in:
commit
154bf8da99
|
@ -7,8 +7,15 @@ Targets may populate this property to publish the include directories
|
|||
which contain system headers, and therefore should not result in
|
||||
compiler warnings. The :command:`target_include_directories(SYSTEM)`
|
||||
command signature populates this property with values given to the
|
||||
``PUBLIC`` and ``INTERFACE`` keywords. Projects may also get and set the
|
||||
property directly.
|
||||
``PUBLIC`` and ``INTERFACE`` keywords.
|
||||
|
||||
Projects may also get and set the property directly, but must be aware that
|
||||
adding directories to this property does not make those directories used
|
||||
during compilation. Adding directories to this property marks directories
|
||||
as ``SYSTEM`` which otherwise would be used in a non-``SYSTEM`` manner. This
|
||||
can appear similar to 'duplication', so prefer the
|
||||
high-level :command:`target_include_directories(SYSTEM)` command and avoid
|
||||
setting the property by low-level means.
|
||||
|
||||
When target dependencies are specified using :command:`target_link_libraries`,
|
||||
CMake will read this property from all target dependencies to mark the
|
||||
|
|
|
@ -1870,7 +1870,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
|
|||
|
||||
std::string includeFlags =
|
||||
this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget,
|
||||
lang, false, useResponseFile);
|
||||
lang, false, useResponseFile,
|
||||
config);
|
||||
if(includeFlags.empty())
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -170,8 +170,10 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source,
|
|||
std::string includeFlags =
|
||||
this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget,
|
||||
language,
|
||||
language == "RC" ? true : false); // full include paths for RC
|
||||
language == "RC" ? true : false, // full include paths for RC
|
||||
// needed by cmcldeps
|
||||
false,
|
||||
this->GetConfigName());
|
||||
if(cmGlobalNinjaGenerator::IsMinGW())
|
||||
cmSystemTools::ReplaceString(includeFlags, "\\", "/");
|
||||
|
||||
|
|
|
@ -14,8 +14,14 @@ target_include_directories(upstream SYSTEM PUBLIC
|
|||
$<TARGET_PROPERTY:systemlib,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
add_library(config_specific INTERFACE)
|
||||
set(testConfig ${CMAKE_BUILD_TYPE})
|
||||
target_include_directories(config_specific SYSTEM INTERFACE
|
||||
"$<$<CONFIG:${testConfig}>:${CMAKE_CURRENT_SOURCE_DIR}/config_specific>"
|
||||
)
|
||||
|
||||
add_library(consumer consumer.cpp)
|
||||
target_link_libraries(consumer upstream)
|
||||
target_link_libraries(consumer upstream config_specific)
|
||||
target_compile_options(consumer PRIVATE -Werror=unused-variable)
|
||||
|
||||
add_library(iface IMPORTED INTERFACE)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
#ifndef CONFIG_IFACE_H
|
||||
#define CONFIG_IFACE_H
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
int configUnusedFunc()
|
||||
{
|
||||
int unused;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#include "upstream.h"
|
||||
|
||||
#include "config_iface.h"
|
||||
|
||||
int consumer()
|
||||
{
|
||||
return upstream();
|
||||
|
|
Loading…
Reference in New Issue