summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Framework
diff options
context:
space:
mode:
authorGregor Jasny <gregor.jasny@logmein.com>2021-12-22 10:38:52 (GMT)
committerGregor Jasny <gregor.jasny@logmein.com>2021-12-22 10:38:52 (GMT)
commit7d99cff236af619a7f1d8275575cd27050809322 (patch)
tree41b4357c69ddf8be2e99fe3585f83085e13b162d /Tests/RunCMake/Framework
parent68b0c62a72a4d3352ed909c208400d02e65a4b61 (diff)
downloadCMake-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
Diffstat (limited to 'Tests/RunCMake/Framework')
-rw-r--r--Tests/RunCMake/Framework/FrameworkSystemIncludeTest.c8
-rw-r--r--Tests/RunCMake/Framework/FrameworkSystemIncludeTest.cmake12
-rw-r--r--Tests/RunCMake/Framework/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/Framework/subdir/Example.framework/Example.tbd0
-rw-r--r--Tests/RunCMake/Framework/subdir/Example.framework/Headers/Example.h1
5 files changed, 33 insertions, 0 deletions
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"