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(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}) 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) find_program(CLANG_TIDY_BINARY NAMES clang-tidy)
if("${CLANG_TIDY_BINARY}" STREQUAL "CLANG_TIDY_BINARY-NOTFOUND") if("${CLANG_TIDY_BINARY}" STREQUAL "CLANG_TIDY_BINARY-NOTFOUND")
message("-- CLANG_TIDY was set but the clang-tidy binary was not found") 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") if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
message("-- Compiler is Clang/LLVM") message("-- Compiler is Clang/LLVM")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CLANG_VERSION) if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 5.0.0)
if(CLANG_VERSION VERSION_LESS 5.0.0)
message(SEND_ERROR "You need at least Clang 5.0.0 to compile EmulationStation-DE") message(SEND_ERROR "You need at least Clang 5.0.0 to compile EmulationStation-DE")
endif() endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
message("-- Compiler is GNU/GCC") message("-- Compiler is GNU/GCC")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpfullversion OUTPUT_VARIABLE G++_VERSION) if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 7.1)
if(G++_VERSION VERSION_LESS 7.1)
message(SEND_ERROR "You need at least GCC 7.1 to compile EmulationStation-DE") message(SEND_ERROR "You need at least GCC 7.1 to compile EmulationStation-DE")
endif() endif()
if(WIN32) if(WIN32)
@ -126,7 +124,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_definitions(-DNOMINMAX) add_definitions(-DNOMINMAX)
endif() endif()
if (CMAKE_BUILD_TYPE) if(CMAKE_BUILD_TYPE)
message("-- Build type is ${CMAKE_BUILD_TYPE}") message("-- Build type is ${CMAKE_BUILD_TYPE}")
endif() endif()
@ -194,7 +192,7 @@ else()
add_definitions(-DUSE_OPENGLES_10) add_definitions(-DUSE_OPENGLES_10)
endif() endif()
if (VLC_PLAYER) if(VLC_PLAYER)
add_definitions(-DBUILD_VLC_PLAYER) add_definitions(-DBUILD_VLC_PLAYER)
endif() endif()