From: Ivan Maidanski Date: Tue, 13 Aug 2019 07:48:28 +0000 (+0300) Subject: Eliminate 'treating c input as c++ when in C++ mode' Clang warning (CMake) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b6d8aadafdc79d8159f3ecac738d6896c960405a;p=gc Eliminate 'treating c input as c++ when in C++ mode' Clang warning (CMake) * CMakeLists.txt [build_tests && enable_cplusplus && !(BORLAND || MSVC || WATCOM)]: Add "-x c++" compile option. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e017f389..eacea37f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)