diff options
Diffstat (limited to 'Tests/CompileFeatures/CMakeLists.txt')
-rw-r--r-- | Tests/CompileFeatures/CMakeLists.txt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 38c44c8..3ba1e0a 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -164,6 +164,38 @@ if (CMAKE_C_COMPILE_FEATURES) ) endif() endif() + + add_executable(CompileFeaturesGenex_C genex_test.c) + set_property(TARGET CompileFeaturesGenex_C PROPERTY C_STANDARD 11) + + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) + list(APPEND expected_defs + EXPECT_C_STATIC_ASSERT=1 + ) + else() + list(APPEND expected_defs + EXPECT_C_STATIC_ASSERT=0 + ) + endif() + elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" + OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang") + list(APPEND expected_defs + EXPECT_C_STATIC_ASSERT=1 + ) + endif() + + list(APPEND expected_defs + EXPECT_C_FUNCTION_PROTOTYPES=1 + EXPECT_C_RESTRICT=1 + ) + + target_compile_definitions(CompileFeaturesGenex_C PRIVATE + HAVE_C_FUNCTION_PROTOTYPES=$<COMPILE_FEATURES:c_function_prototypes> + HAVE_C_RESTRICT=$<COMPILE_FEATURES:c_restrict> + HAVE_C_STATIC_ASSERT=$<COMPILE_FEATURES:c_static_assert> + ${expected_defs} + ) endif() if (CMAKE_CXX_COMPILE_FEATURES) |