Browse Source

Tests/Module/WCDH: only use -Werror=undef compiler flag if actually supported

Rolf Eike Beer 8 years ago
parent
commit
940bf6a4a4
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt

+ 5 - 1
Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt

@@ -68,7 +68,11 @@ if (CMAKE_C_COMPILE_FEATURES)
 
     add_executable(C_undefined c_undefined.c)
     set_property(TARGET C_undefined PROPERTY C_STANDARD 90)
-    target_compile_options(C_undefined PRIVATE -Werror=undef)
+    include(CheckCCompilerFlag)
+    check_c_compiler_flag(-Werror=undef use_error_undef)
+    if (use_error_undef)
+        target_compile_options(C_undefined PRIVATE -Werror=undef)
+    endif()
 
     add_executable(WriteCompilerDetectionHeader_C main.c)
     set_property(TARGET WriteCompilerDetectionHeader_C PROPERTY C_STANDARD 90)