summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-07-16 17:59:07 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-07-16 17:59:07 (GMT)
commit41a2fb5ba0df4dd70029e8701c7c3bd407e70032 (patch)
treea116d3b8ebf60b41c00ac6c0dac18f33c640c191 /Tests
parent029e836a212b1069bda38ec09fe6614c68b12cc5 (diff)
parent9cf3547e1cd56d42bc96c3dc3adf9f745faea5ee (diff)
downloadCMake-41a2fb5ba0df4dd70029e8701c7c3bd407e70032.zip
CMake-41a2fb5ba0df4dd70029e8701c7c3bd407e70032.tar.gz
CMake-41a2fb5ba0df4dd70029e8701c7c3bd407e70032.tar.bz2
Merge topic 'tid-system-argument'
9cf3547 Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property. 1925cff Add a SYSTEM parameter to target_include_directories (#14180) 286f227 Extend the cmTargetPropCommandBase interface property handling. 83498d4 Store system include directories in the cmTarget. f1fcbe3 Add Target API to determine if an include is a system include. 2679a34 Remove unused variable.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/IncludeDirectories/CMakeLists.txt17
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt19
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp7
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/systemlib.cpp4
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/systemlib.h19
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/upstream.cpp4
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/upstream.h12
7 files changed, 82 insertions, 0 deletions
diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt
index 3e3ecc9..596a280 100644
--- a/Tests/IncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/CMakeLists.txt
@@ -1,6 +1,23 @@
cmake_minimum_required (VERSION 2.6)
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)
+ 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)
+ # The Bullseye wrapper appears to break the -isystem effect.
+ execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE out ERROR_VARIABLE out)
+ if("x${out}" MATCHES "Bullseye")
+ set(run_sys_includes_test 0)
+ endif()
+ endif()
+ if (run_sys_includes_test)
+ add_subdirectory(SystemIncludeDirectories)
+ endif()
+endif()
+
file(WRITE ${CMAKE_BINARY_DIR}/Flags/Flags.h
"//Flags.h
")
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
new file mode 100644
index 0000000..aec6ff9
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
@@ -0,0 +1,19 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(SystemIncludeDirectories)
+
+add_library(systemlib systemlib.cpp)
+target_include_directories(systemlib PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/systemlib")
+
+add_library(upstream upstream.cpp)
+target_link_libraries(upstream LINK_PUBLIC systemlib)
+target_compile_options(upstream PRIVATE -Werror=unused-variable)
+
+target_include_directories(upstream SYSTEM PUBLIC
+ $<TARGET_PROPERTY:systemlib,INTERFACE_INCLUDE_DIRECTORIES>
+)
+
+add_library(consumer consumer.cpp)
+target_link_libraries(consumer upstream)
+target_compile_options(consumer PRIVATE -Werror=unused-variable)
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp
new file mode 100644
index 0000000..197dae8
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp
@@ -0,0 +1,7 @@
+
+#include "upstream.h"
+
+int consumer()
+{
+ return upstream();
+}
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib.cpp
new file mode 100644
index 0000000..f111bfa
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib.cpp
@@ -0,0 +1,4 @@
+
+#include "systemlib.h"
+
+int systemlib() { return 0; }
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/systemlib.h b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/systemlib.h
new file mode 100644
index 0000000..c84de6a
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/systemlib.h
@@ -0,0 +1,19 @@
+
+#ifndef SYSTEMLIB_H
+#define SYSTEMLIB_H
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int systemlib();
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int unusedFunc()
+{
+ int unused;
+ return systemlib();
+}
+
+#endif
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.cpp
new file mode 100644
index 0000000..f716b99
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.cpp
@@ -0,0 +1,4 @@
+
+#include "upstream.h"
+
+int upstream() { return systemlib(); }
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.h b/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.h
new file mode 100644
index 0000000..3628568
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.h
@@ -0,0 +1,12 @@
+
+#ifndef UPSTREAM_H
+#define UPSTREAM_H
+
+#include "systemlib.h"
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int upstream();
+
+#endif