diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-08-29 08:28:09 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-09-24 18:00:31 (GMT) |
commit | a63fcbcb9f6c09294dfbeb8480be822f42529755 (patch) | |
tree | 7d24cffa66390814152293270a126ad030da2a39 /Tests/ExportImport/Import | |
parent | 9bcf6adc388c2306033c65270357eb1a1da83d76 (diff) | |
download | CMake-a63fcbcb9f6c09294dfbeb8480be822f42529755.zip CMake-a63fcbcb9f6c09294dfbeb8480be822f42529755.tar.gz CMake-a63fcbcb9f6c09294dfbeb8480be822f42529755.tar.bz2 |
Always consider includes from IMPORTED targets to be SYSTEM.
Introduce a target property to control this behavior variable
to set the default value for the target property.
This does not affect try_compile runs.
Diffstat (limited to 'Tests/ExportImport/Import')
-rw-r--r-- | Tests/ExportImport/Import/A/CMakeLists.txt | 47 | ||||
-rw-r--r-- | Tests/ExportImport/Import/A/test_system.cpp | 9 |
2 files changed, 56 insertions, 0 deletions
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; +} |