]> granicus.if.org Git - gc/commitdiff
Eliminate 'treating c input as c++ when in C++ mode' Clang warning (CMake)
authorIvan Maidanski <ivmai@mail.ru>
Tue, 13 Aug 2019 07:48:28 +0000 (10:48 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 13 Aug 2019 07:48:28 +0000 (10:48 +0300)
* CMakeLists.txt [build_tests && enable_cplusplus
&& !(BORLAND || MSVC || WATCOM)]: Add "-x c++" compile option.

CMakeLists.txt

index e017f389a5bd7838a6e81dc4b6c67e1e43b4dd5c..eacea37f9d907f52f8f9010b35f0748f86da610b 100644 (file)
@@ -394,7 +394,11 @@ if (build_tests)
   if (enable_cplusplus)
     set_source_files_properties(tests/leak_test.c tests/test.c
                                 PROPERTIES LANGUAGE CXX)
-  endif()
+    # To avoid "treating 'c' input as 'c++' when in C++ mode" Clang warning.
+    if (NOT (BORLAND OR MSVC OR WATCOM))
+      add_compile_options(-x c++)
+    endif()
+  endif(enable_cplusplus)
 
   add_executable(gctest WIN32 tests/test.c)
   target_link_libraries(gctest PRIVATE gc)