IncludeDirectories: Respect SYSTEM flag when using CONFIG genex.
Update the Makefile and Ninja generators to use the config when requesting the include flags.
This commit is contained in:
parent
98bf613cd0
commit
ee38062be8
|
@ -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