Fix compiler detection and flags

- Use CMAKE_<LANG>_COMPILER_ID to detect compiler as CMake docs suggest
- Support clang properly
- Don't set -Werror
This commit is contained in:
Dmitry Marakasov 2021-12-20 20:16:45 +03:00
parent d04d618253
commit dafda54e50

View file

@ -843,10 +843,10 @@ endif()
# Stratagus needs to have char by default signed
# No idea how to tell this to other compilers
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char -Werror")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char")
endif()
if(CMAKE_COMPILER_IS_GNUC)
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsigned-char")
endif()
if(WIN32 AND MSVC)