diff options
author | Gregor Jasny <gregor.jasny@logmein.com> | 2021-12-22 10:38:52 (GMT) |
---|---|---|
committer | Gregor Jasny <gregor.jasny@logmein.com> | 2021-12-22 10:38:52 (GMT) |
commit | 7d99cff236af619a7f1d8275575cd27050809322 (patch) | |
tree | 41b4357c69ddf8be2e99fe3585f83085e13b162d | |
parent | 68b0c62a72a4d3352ed909c208400d02e65a4b61 (diff) | |
download | CMake-7d99cff236af619a7f1d8275575cd27050809322.zip CMake-7d99cff236af619a7f1d8275575cd27050809322.tar.gz CMake-7d99cff236af619a7f1d8275575cd27050809322.tar.bz2 |
Xcode: Properly identify frameworks with system includes
Check the complete include path for being a system include, not
the derived framework search path. The code for Ninja and Makefile
generators does exactly the same.
Fixes: #23011
6 files changed, 34 insertions, 1 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 44a3eb7..bc2a6f7 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2683,7 +2683,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, if (emitted.insert(frameworkDir).second) { std::string incpath = this->XCodeEscapePath(frameworkDir); if (emitSystemIncludes && - gtgt->IsSystemIncludeDirectory(frameworkDir, configName, + gtgt->IsSystemIncludeDirectory(include, configName, langForPreprocessor)) { sysfdirs.Add(incpath); } else { diff --git a/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.c b/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.c new file mode 100644 index 0000000..644a978 --- /dev/null +++ b/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.c @@ -0,0 +1,8 @@ +#include <Example/Example.h> + +int foo(void); + +int foo(void) +{ + return 42; +} diff --git a/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.cmake b/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.cmake new file mode 100644 index 0000000..d172281 --- /dev/null +++ b/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +add_library(Example::Example SHARED IMPORTED) +set_target_properties(Example::Example PROPERTIES + FRAMEWORK 1 + IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/subdir/Example.framework/Example.tbd" + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/subdir/Example.framework;${CMAKE_CURRENT_SOURCE_DIR}/subdir/Example.framework/Headers" +) + +add_library(testcase FrameworkSystemIncludeTest.c) +target_compile_options(testcase PRIVATE "-Werror=#pragma-messages") +target_link_libraries(testcase PRIVATE Example::Example) diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake index 36eaf5c..2f8fdc7 100644 --- a/Tests/RunCMake/Framework/RunCMakeTest.cmake +++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake @@ -93,3 +93,15 @@ function(imported_framework_test) endfunction() imported_framework_test() + +function(framework_system_include_test) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/FrameworkSystemIncludeTest-build") + set(RunCMake_TEST_NO_CLEAN 1) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(FrameworkSystemIncludeTest) + run_cmake_command(FrameworkSystemIncludeTest-build ${CMAKE_COMMAND} --build .) +endfunction() + +framework_system_include_test() diff --git a/Tests/RunCMake/Framework/subdir/Example.framework/Example.tbd b/Tests/RunCMake/Framework/subdir/Example.framework/Example.tbd new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Framework/subdir/Example.framework/Example.tbd diff --git a/Tests/RunCMake/Framework/subdir/Example.framework/Headers/Example.h b/Tests/RunCMake/Framework/subdir/Example.framework/Headers/Example.h new file mode 100644 index 0000000..92cdb70 --- /dev/null +++ b/Tests/RunCMake/Framework/subdir/Example.framework/Headers/Example.h @@ -0,0 +1 @@ +#pragma GCC warning "This should be suppressed" |