Don't overwrite user-specified CFLAGS and CXXFLAGS (#51)

* Check C and C++ compiler separately

It's possible (however unlikely) that the C++ compiler might be clang
but the C compiler might not be.

* Don't overwrite user-specified CFLAGS and CXXFLAGS
This commit is contained in:
Ryan Schmidt 2022-11-19 21:32:44 -06:00 committed by GitHub
parent a76287876c
commit b8d17f4481
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -10,9 +10,13 @@ set(CMAKE_C_STANDARD_REQUIRED TRUE)
set(CMAKE_C_EXTENSIONS FALSE)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# Clang or AppleClang
set(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}")
endif()
if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
# Clang or AppleClang
set(CMAKE_CXX_FLAGS "-Wall")
set(CMAKE_C_FLAGS "-Wall")
set(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}")
endif()