Detect clang and automatically set USE_CLANG.

User may forget or not know about -DUSE_CLANG=TRUE. It could probably
be always autodetected instead of requiring user input.
.
Trivial wording changes to compiler_version.
This commit is contained in:
Miguel A. Colón Vélez 2014-12-28 04:05:22 -05:00 committed by Gregory Hainaut
parent c8c22cf6a0
commit be1842f4e9
2 changed files with 9 additions and 4 deletions

View File

@ -63,6 +63,11 @@ endif()
option(USE_CLANG "Use llvm/clang to build PCSX2 (developer option)")
option(USE_ASAN "Enable address sanitizer")
# It's probably better to autodetect the USE_CLANG. Remove the option?
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT USE_CLANG)
set(USE_CLANG TRUE)
endif()
#-------------------------------------------------------------------------------
# Select the architecture
#-------------------------------------------------------------------------------

View File

@ -54,16 +54,16 @@ function(write_svnrev_h)
endfunction()
function(check_compiler_version version_warn version_err)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
string(STRIP "${GCC_VERSION}" GCC_VERSION)
if(GCC_VERSION VERSION_LESS ${version_err})
message(FATAL_ERROR "PCSX2 doesn't support your old GCC ${GCC_VERSION}! Please upgrade it !
message(FATAL_ERROR "PCSX2 doesn't support your old GCC ${GCC_VERSION}! Please upgrade it!
The minimum version is ${version_err} but ${version_warn} is warmly recommended")
The minimum supported version is ${version_err} but ${version_warn} is warmly recommended")
else()
if(GCC_VERSION VERSION_LESS ${version_warn})
message(WARNING "PCSX2 will stop to support GCC ${GCC_VERSION} in a near future. Please upgrade it to GCC ${version_warn}.")
message(WARNING "PCSX2 will stop supporting GCC ${GCC_VERSION} in the near future. Please upgrade to at least GCC ${version_warn}.")
endif()
endif()
endif()