From 543dcb0ada5047d789a19dbbffa9028cb1b317c7 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Wed, 23 Nov 2016 18:19:54 +0100 Subject: Revert "Xcode: Obey SYSTEM keyword for includes (#15687)" Revert commit v3.7.0-rc1~266^2 (Xcode: Obey SYSTEM keyword for includes, 2015-08-31). It worked for C, C++, and Swift but not for GNU Assembly files for which Xcode has no property to set flags. Closes: #16449 --- Source/cmGlobalXCodeGenerator.cxx | 44 +++++++--------------- Tests/IncludeDirectories/CMakeLists.txt | 4 +- .../SystemIncludeDirectories/CMakeLists.txt | 15 ++------ 3 files changed, 19 insertions(+), 44 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4ff612d..537aa16 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1894,40 +1894,24 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, BuildObjectListOrString dirs(this, this->XcodeVersion >= 30); BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30); + std::vector includes; + this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, "C", + configName); std::set emitted; emitted.insert("/System/Library/Frameworks"); - if (this->XcodeVersion < 60) { - std::vector includes; - this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, "C", - configName); - for (std::vector::iterator i = includes.begin(); - i != includes.end(); ++i) { - if (this->NameResolvesToFramework(*i)) { - std::string frameworkDir = *i; - frameworkDir += "/../"; - frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); - if (emitted.insert(frameworkDir).second) { - fdirs.Add(this->XCodeEscapePath(frameworkDir)); - } - } else { - std::string incpath = this->XCodeEscapePath(*i); - dirs.Add(incpath); - } - } - } else { - for (std::set::iterator li = languages.begin(); - li != languages.end(); ++li) { - std::vector includes; - this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, *li, - configName); - std::string includeFlags = this->CurrentLocalGenerator->GetIncludeFlags( - includes, gtgt, *li, true, false, configName); - - std::string& flags = cflags[*li]; - if (!includeFlags.empty()) { - flags += " " + includeFlags; + for (std::vector::iterator i = includes.begin(); + i != includes.end(); ++i) { + if (this->NameResolvesToFramework(*i)) { + std::string frameworkDir = *i; + frameworkDir += "/../"; + frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); + if (emitted.insert(frameworkDir).second) { + fdirs.Add(this->XCodeEscapePath(frameworkDir)); } + } else { + std::string incpath = this->XCodeEscapePath(*i); + dirs.Add(incpath); } } // Add framework search paths needed for linking. diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt index db18462..4920582 100644 --- a/Tests/IncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -3,9 +3,7 @@ project(IncludeDirectories) if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4) OR CMAKE_C_COMPILER_ID STREQUAL Clang OR CMAKE_C_COMPILER_ID STREQUAL AppleClang) - AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" - OR CMAKE_GENERATOR STREQUAL "Ninja" - OR (CMAKE_GENERATOR STREQUAL "Xcode" AND NOT XCODE_VERSION VERSION_LESS 6.0))) + AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja")) include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-Wunused-variable run_sys_includes_test) if(run_sys_includes_test) diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt index 5078f30..dcee85e 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt @@ -15,17 +15,10 @@ target_include_directories(upstream SYSTEM PUBLIC ) add_library(config_specific INTERFACE) -if(CMAKE_GENERATOR STREQUAL "Xcode") - # CMAKE_BUILD_TYPE does not work here for multi-config generators - target_include_directories(config_specific SYSTEM INTERFACE - "${CMAKE_CURRENT_SOURCE_DIR}/config_specific" - ) -else() - set(testConfig ${CMAKE_BUILD_TYPE}) - target_include_directories(config_specific SYSTEM INTERFACE - "$<$:${CMAKE_CURRENT_SOURCE_DIR}/config_specific>" - ) -endif() +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 config_specific) -- cgit v0.12