diff options
author | Brad King <brad.king@kitware.com> | 2013-10-07 19:45:05 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-10-07 19:45:05 (GMT) |
commit | 4e1368c1a02e26464c94a5aa23a8ec3b27755775 (patch) | |
tree | 54dd177a444c2cd0289953745608073a2fa14351 /Tests/ExportImport | |
parent | b38425fa4b15e4858f0b06bf75ba824550b87c34 (diff) | |
parent | a63fcbcb9f6c09294dfbeb8480be822f42529755 (diff) | |
download | CMake-4e1368c1a02e26464c94a5aa23a8ec3b27755775.zip CMake-4e1368c1a02e26464c94a5aa23a8ec3b27755775.tar.gz CMake-4e1368c1a02e26464c94a5aa23a8ec3b27755775.tar.bz2 |
Merge topic 'IMPORTED-target-SYSTEM-includes'
a63fcbc Always consider includes from IMPORTED targets to be SYSTEM.
Diffstat (limited to 'Tests/ExportImport')
-rw-r--r-- | Tests/ExportImport/Export/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/ExportImport/Export/systemlib.cpp | 7 | ||||
-rw-r--r-- | Tests/ExportImport/Export/systemlib.h | 22 | ||||
-rw-r--r-- | Tests/ExportImport/Import/A/CMakeLists.txt | 47 | ||||
-rw-r--r-- | Tests/ExportImport/Import/A/test_system.cpp | 9 |
5 files changed, 95 insertions, 0 deletions
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 72ae78f..f225ce1 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -298,6 +298,14 @@ set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3 add_library(noIncludesInterface empty.cpp) +add_library(systemlib SHARED systemlib.cpp) +install(FILES systemlib.h DESTINATION include/systemlib) +target_include_directories(systemlib + INTERFACE + $<INSTALL_INTERFACE:include/systemlib> + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> +) + install(TARGETS testLibRequired EXPORT RequiredExp DESTINATION lib INCLUDES DESTINATION @@ -366,6 +374,7 @@ install( testLib6 testLibCycleA testLibCycleB cmp0022NEW cmp0022OLD + systemlib EXPORT exp RUNTIME DESTINATION bin LIBRARY DESTINATION lib NAMELINK_SKIP @@ -417,6 +426,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 testSharedLibRequired testSharedLibRequiredUser testSharedLibRequiredUser2 testSharedLibDepends renamed_on_export cmp0022NEW cmp0022OLD + systemlib NAMESPACE bld_ FILE ExportBuildTree.cmake ) diff --git a/Tests/ExportImport/Export/systemlib.cpp b/Tests/ExportImport/Export/systemlib.cpp new file mode 100644 index 0000000..ec45148 --- /dev/null +++ b/Tests/ExportImport/Export/systemlib.cpp @@ -0,0 +1,7 @@ + +#include "systemlib.h" + +SystemStruct::SystemStruct() +{ + +} diff --git a/Tests/ExportImport/Export/systemlib.h b/Tests/ExportImport/Export/systemlib.h new file mode 100644 index 0000000..f7900c0 --- /dev/null +++ b/Tests/ExportImport/Export/systemlib.h @@ -0,0 +1,22 @@ + +#ifndef SYSTEMLIB_H +#define SYSTEMLIB_H + +#if defined(_WIN32) || defined(__CYGWIN__) +# define systemlib_EXPORT __declspec(dllexport) +#else +# define systemlib_EXPORT +#endif + +struct systemlib_EXPORT SystemStruct +{ + SystemStruct(); + + void someMethod() + { + int unused; + // unused warning not issued when this header is used as a system header. + } +}; + +#endif diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 2627354..ebe4af2 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -265,3 +265,50 @@ foreach(_config ${_configs}) ) endforeach() unset(_configs) + +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_executable(test_system_exp test_system.cpp) + target_link_libraries(test_system_exp exp_systemlib) + target_compile_options(test_system_exp PRIVATE -Wunused-variable -Werror=unused-variable) + + unset(EXP_ERROR_VARIABLE CACHE) + try_compile(EXP_ERROR_VARIABLE + "${CMAKE_CURRENT_SOURCE_DIR}/test_system" + "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp" + COMPILE_DEFINITIONS "-Wunused-variable -Werror=unused-variable" + LINK_LIBRARIES exp_systemlib + OUTPUT_VARIABLE OUTPUT + ) + if(NOT EXP_ERROR_VARIABLE) + message(SEND_ERROR "EXP_ERROR_VARIABLE try_compile failed, but it was expected to succeed ${OUTPUT}.") + endif() + + add_executable(test_system_bld test_system.cpp) + target_link_libraries(test_system_bld bld_systemlib) + target_compile_options(test_system_bld PRIVATE -Wunused-variable -Werror=unused-variable) + + unset(BLD_ERROR_VARIABLE CACHE) + try_compile(BLD_ERROR_VARIABLE + "${CMAKE_CURRENT_SOURCE_DIR}/test_system" + "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp" + COMPILE_DEFINITIONS "-Wunused-variable -Werror=unused-variable" + LINK_LIBRARIES bld_systemlib + OUTPUT_VARIABLE OUTPUT + ) + if(NOT BLD_ERROR_VARIABLE) + message(SEND_ERROR "BLD_ERROR_VARIABLE try_compile failed, but it was expected to succeed.") + endif() + endif() +endif() diff --git a/Tests/ExportImport/Import/A/test_system.cpp b/Tests/ExportImport/Import/A/test_system.cpp new file mode 100644 index 0000000..aae3583 --- /dev/null +++ b/Tests/ExportImport/Import/A/test_system.cpp @@ -0,0 +1,9 @@ + +#include "systemlib.h" + +int main() +{ + SystemStruct s; + (void)s; + return 0; +} |