From ee38062be8ccdb7f4c53156ef00db0d42a41a6a7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 22 Jan 2015 23:40:27 +0100 Subject: IncludeDirectories: Respect SYSTEM flag when using CONFIG genex. Update the Makefile and Ninja generators to use the config when requesting the include flags. --- Source/cmMakefileTargetGenerator.cxx | 3 ++- Source/cmNinjaTargetGenerator.cxx | 4 +++- .../SystemIncludeDirectories/CMakeLists.txt | 8 +++++++- .../config_specific/config_iface.h | 14 ++++++++++++++ .../SystemIncludeDirectories/consumer.cpp | 2 ++ 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f8471fd..7ed0c10 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -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; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index c019ceb..67824c6 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -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, "\\", "/"); diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt index abe9f74..0215e93 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt @@ -14,8 +14,14 @@ target_include_directories(upstream SYSTEM PUBLIC $ ) +add_library(config_specific INTERFACE) +set(testConfig ${CMAKE_BUILD_TYPE}) +target_include_directories(config_specific SYSTEM INTERFACE + "$<$:${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) diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h b/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h new file mode 100644 index 0000000..05d3604 --- /dev/null +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h @@ -0,0 +1,14 @@ + +#ifndef CONFIG_IFACE_H +#define CONFIG_IFACE_H + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int configUnusedFunc() +{ + int unused; + return 0; +} + +#endif diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp index 197dae8..be18ebf 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp @@ -1,6 +1,8 @@ #include "upstream.h" +#include "config_iface.h" + int consumer() { return upstream(); -- cgit v0.12