Build: Add support for compiler detection

Using this system we can separate settings for different compilers nicely.
This commit is contained in:
Peter Keresztes Schmidt 2021-02-08 21:50:36 +01:00
parent 36253048f5
commit 407ea70991
3 changed files with 9 additions and 0 deletions

View File

@ -33,3 +33,12 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
endif()
endif()
endif()
message(STATUS "Detected compiler: ${CMAKE_C_COMPILER}")
if(CMAKE_C_COMPILER MATCHES "gcc" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
include(${CMAKE_SOURCE_DIR}/cmake/compiler/gcc/settings.cmake)
elseif(CMAKE_C_COMPILER MATCHES "clang" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
include(${CMAKE_SOURCE_DIR}/cmake/compiler/clang/settings.cmake)
else()
message(FATAL_ERROR "No supported compiler found")
endif()

View File

View File