1
0

Fix clang 3.6 flags to only be used in clang 3.6

This commit is contained in:
tycho 2015-05-24 15:22:55 +01:00
parent 76a3165f09
commit 51b4584b42
2 changed files with 18 additions and 11 deletions

View File

@ -27,6 +27,16 @@ macro(add_flags_cxx FLAGS)
endmacro() endmacro()
#this is a hack because we can't use cmake 2.8.10 because of travis
macro(get_clang_version)
execute_process(
COMMAND "${CMAKE_CXX_COMPILER}" "--version"
OUTPUT_VARIABLE CLANG_VERSION_OUTPUT)
string(REGEX MATCH "version ([0-9]\\.[0-9])" x ${CLANG_VERSION_OUTPUT})
set(CLANG_VERSION ${CMAKE_MATCH_1})
endmacro()
macro(set_flags) macro(set_flags)
# Add coverage processing, if requested: # Add coverage processing, if requested:
if (NOT MSVC) if (NOT MSVC)
@ -113,6 +123,10 @@ macro(set_flags)
add_flags_cxx("-march=native") add_flags_cxx("-march=native")
endif() endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
get_clang_version()
endif()
# Use static CRT in MSVC builds: # Use static CRT in MSVC builds:
if (MSVC) if (MSVC)
@ -215,15 +229,6 @@ macro(enable_profile)
endif() endif()
endmacro() endmacro()
#this is a hack because we can't use cmake 2.8.10 because of travis
macro(get_clang_version)
execute_process(
COMMAND "${CMAKE_CXX_COMPILER}" "--version"
OUTPUT_VARIABLE CLANG_VERSION_OUTPUT)
string(REGEX MATCH "version ([0-9]\\.[0-9])" x ${CLANG_VERSION_OUTPUT})
set(CLANG_VERSION ${CMAKE_MATCH_1})
endmacro()
macro(set_exe_flags) macro(set_exe_flags)
# Remove disabling the maximum warning level: # Remove disabling the maximum warning level:
# clang does not like a command line that reads -Wall -Wextra -w -Wall -Wextra and does not output any warnings # clang does not like a command line that reads -Wall -Wextra -w -Wall -Wextra and does not output any warnings
@ -242,7 +247,6 @@ macro(set_exe_flags)
add_flags_cxx("-ffast-math") add_flags_cxx("-ffast-math")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
get_clang_version()
if ("${CLANG_VERSION}" VERSION_LESS 3.0) if ("${CLANG_VERSION}" VERSION_LESS 3.0)
message(FATAL_ERROR "MCServer requires clang version 3.0 or higher, version is ${CLANG_VERSION}") message(FATAL_ERROR "MCServer requires clang version 3.0 or higher, version is ${CLANG_VERSION}")
endif() endif()

View File

@ -42,7 +42,10 @@ if (MSVC)
endif() endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_flags_cxx("-Wno-error=conversion -Wno-error=old-style-cast -Wno-error=inconsistent-missing-override") add_flags_cxx("-Wno-error=conversion -Wno-error=old-style-cast")
if ("${CLANG_VERSION}" VERSION_GREATER 3.5)
add_flags_cxx("-Wno-error=inconsistent-missing-override")
endif()
endif() endif()
# Define individual tests: # Define individual tests: