Made CMake use a more reliable way for detecting the compiler version.

This commit is contained in:
Leon Styhre 2021-09-19 15:55:47 +02:00
parent 970b7dd63d
commit dacda90186

View file

@ -37,7 +37,7 @@ option(CEC "Set to ON to enable CEC" ${CEC})
option(VLC_PLAYER "Set to ON to build the VLC-based video player" ${VLC_PLAYER})
option(CLANG_TIDY "Set to ON to build using the clang-tidy static analyzer" ${CLANG_TIDY})
if (CLANG_TIDY)
if(CLANG_TIDY)
find_program(CLANG_TIDY_BINARY NAMES clang-tidy)
if("${CLANG_TIDY_BINARY}" STREQUAL "CLANG_TIDY_BINARY-NOTFOUND")
message("-- CLANG_TIDY was set but the clang-tidy binary was not found")
@ -107,14 +107,12 @@ endif()
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
message("-- Compiler is Clang/LLVM")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CLANG_VERSION)
if(CLANG_VERSION VERSION_LESS 5.0.0)
if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 5.0.0)
message(SEND_ERROR "You need at least Clang 5.0.0 to compile EmulationStation-DE")
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
message("-- Compiler is GNU/GCC")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpfullversion OUTPUT_VARIABLE G++_VERSION)
if(G++_VERSION VERSION_LESS 7.1)
if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 7.1)
message(SEND_ERROR "You need at least GCC 7.1 to compile EmulationStation-DE")
endif()
if(WIN32)
@ -126,7 +124,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_definitions(-DNOMINMAX)
endif()
if (CMAKE_BUILD_TYPE)
if(CMAKE_BUILD_TYPE)
message("-- Build type is ${CMAKE_BUILD_TYPE}")
endif()
@ -194,7 +192,7 @@ else()
add_definitions(-DUSE_OPENGLES_10)
endif()
if (VLC_PLAYER)
if(VLC_PLAYER)
add_definitions(-DBUILD_VLC_PLAYER)
endif()