summaryrefslogtreecommitdiffstats
path: root/Tests/IncludeDirectories
diff options
context:
space:
mode:
authorEphi Sinowitz <esinowitz@bloomberg.net>2018-04-13 11:58:47 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-23 15:47:52 (GMT)
commit76ad2ecb500c8652e59179959b8ecee28a5196de (patch)
tree2b1e52f6d39890d9b5fef4295999da7a5c20dbd8 /Tests/IncludeDirectories
parentfe0082875aeecead23b2351629abca4990dfba43 (diff)
downloadCMake-76ad2ecb500c8652e59179959b8ecee28a5196de.zip
CMake-76ad2ecb500c8652e59179959b8ecee28a5196de.tar.gz
CMake-76ad2ecb500c8652e59179959b8ecee28a5196de.tar.bz2
Order SYSTEM include directories after non-system directories
An effect of the `-isystem` flag is to search the directory after those specified via `-I` flags. Make behavior more consistent on compilers that do not have any `-isystem` flag by explicitly moving system include directories to the end.
Diffstat (limited to 'Tests/IncludeDirectories')
-rw-r--r--Tests/IncludeDirectories/CMakeLists.txt4
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/ordertest.h1
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/userlib/ordertest.h1
-rw-r--r--Tests/IncludeDirectories/ordertest.cpp1
4 files changed, 7 insertions, 0 deletions
diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt
index db18462..b7b8320 100644
--- a/Tests/IncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/CMakeLists.txt
@@ -65,6 +65,10 @@ else()
PROPERTIES COMPILE_FLAGS "-ITarProp")
endif()
+add_library(ordertest ordertest.cpp)
+target_include_directories(ordertest SYSTEM PUBLIC SystemIncludeDirectories/systemlib)
+target_include_directories(ordertest PUBLIC SystemIncludeDirectories/userlib)
+
add_subdirectory(StandardIncludeDirectories)
add_subdirectory(TargetIncludeDirectories)
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/ordertest.h b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/ordertest.h
new file mode 100644
index 0000000..28915e6
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/ordertest.h
@@ -0,0 +1 @@
+#error ordertest.h includes from systemlib
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/userlib/ordertest.h b/Tests/IncludeDirectories/SystemIncludeDirectories/userlib/ordertest.h
new file mode 100644
index 0000000..fa882cb
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/userlib/ordertest.h
@@ -0,0 +1 @@
+/* empty file */
diff --git a/Tests/IncludeDirectories/ordertest.cpp b/Tests/IncludeDirectories/ordertest.cpp
new file mode 100644
index 0000000..7e24f77
--- /dev/null
+++ b/Tests/IncludeDirectories/ordertest.cpp
@@ -0,0 +1 @@
+#include "ordertest.h"