diff options
Diffstat (limited to 'Tests/ExportImport')
-rw-r--r-- | Tests/ExportImport/Export/Interface/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/ExportImport/Import/Interface/CMakeLists.txt | 21 |
2 files changed, 25 insertions, 1 deletions
diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt index 1b653eb..523fc29 100644 --- a/Tests/ExportImport/Export/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt @@ -26,7 +26,10 @@ target_link_libraries(sharediface INTERFACE sharedlib) add_library(use_auto_type INTERFACE) target_compile_features(use_auto_type INTERFACE cxx_auto_type) -install(TARGETS headeronly sharediface use_auto_type +add_library(use_c_restrict INTERFACE) +target_compile_features(use_c_restrict INTERFACE c_restrict) + +install(TARGETS headeronly sharediface use_auto_type use_c_restrict EXPORT expInterface ) install(TARGETS sharedlib diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt index 18d9b76..4028405 100644 --- a/Tests/ExportImport/Import/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt @@ -17,6 +17,7 @@ set_property(TARGET bld::sharediface APPEND PROPERTY INTERFACE_LINK_LIBRARIES de add_executable(interfacetest_bld interfacetest.cpp) target_link_libraries(interfacetest_bld bld::sharediface) +include(CheckCSourceCompiles) include(CheckCXXSourceCompiles) macro(do_try_compile prefix) @@ -41,6 +42,26 @@ macro(do_try_compile prefix) message(SEND_ERROR "${prefix} try_compile with IMPORTED INTERFACE target failed!\n\n${OUTPUT}") endif() + if (";${CMAKE_C_COMPILE_FEATURES};" MATCHES ";c_restrict;") + set(CMAKE_REQUIRED_LIBRARIES ${prefix}::use_c_restrict) + check_c_source_compiles( + " + int foo(int * restrict a, int * restrict b) + { + (void)a; + (void)b; + return 0; + } + int main() + { + return 0; + } + " ${prefix}IMPORTED_IFACE_C_RESTRICT) + + if(NOT ${prefix}IMPORTED_IFACE_C_RESTRICT) + message(SEND_ERROR "${prefix} try_compile with IMPORTED INTERFACE target failed!\n\n${OUTPUT}") + endif() + endif() if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_auto_type;") set(CMAKE_REQUIRED_LIBRARIES ${prefix}::use_auto_type) check_cxx_source_compiles( |