diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-07-02 12:30:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-07-16 17:44:57 (GMT) |
commit | 9cf3547e1cd56d42bc96c3dc3adf9f745faea5ee (patch) | |
tree | ea220c1949611ac1977841ea77ff22bcac061497 /Tests/IncludeDirectories/SystemIncludeDirectories | |
parent | 1925cffa083bcbe3c54b8a0f2c63dc96f5168db0 (diff) | |
download | CMake-9cf3547e1cd56d42bc96c3dc3adf9f745faea5ee.zip CMake-9cf3547e1cd56d42bc96c3dc3adf9f745faea5ee.tar.gz CMake-9cf3547e1cd56d42bc96c3dc3adf9f745faea5ee.tar.bz2 |
Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property.
Unlike other target properties, this does not have a corresponding
non-INTERFACE variant.
This allows propagation of system attribute on include directories
from link dependents.
Diffstat (limited to 'Tests/IncludeDirectories/SystemIncludeDirectories')
6 files changed, 65 insertions, 0 deletions
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 |