From f22b9aa5f4ea4fe012267c1db28dfbe3ce374013 Mon Sep 17 00:00:00 2001 From: worktycho Date: Sat, 6 Sep 2014 14:38:47 +0100 Subject: Should now compile in clang 3.0 --- SetFlags.cmake | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/SetFlags.cmake b/SetFlags.cmake index 0e2e0c277..7d845ebb7 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -223,17 +223,28 @@ macro(set_exe_flags) add_flags_cxx("-ffast-math") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + if (CLANG_VERSION_STRING VERSION_LESS 3.0) + message(FATAL_ERROR "MCServer requires clang version 3.0 or higher") + endif() # clang does not provide the __extern_always_inline macro and a part of libm depends on this when using fast-math add_flags_cxx("-D__extern_always_inline=inline") add_flags_cxx("-Werror -Weverything -Wno-c++98-compat-pedantic -Wno-string-conversion") - add_flags_cxx("-Wno-error=switch-enum -Wno-documentation -Wno-exit-time-destructors") + add_flags_cxx("-Wno-error=switch-enum -Wno-exit-time-destructors") add_flags_cxx("-Wno-error=sign-conversion -Wno-error=conversion -Wno-padded") add_flags_cxx("-Wno-error=deprecated -Wno-error=weak-vtables -Wno-error=float-equal") add_flags_cxx("-Wno-error=missing-prototypes -Wno-error=non-virtual-dtor") - add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=shadow -Wno-error=old-style-cast") - add_flags_cxx("-Wno-error=exit-time-destructors -Wno-error=missing-variable-declarations") - add_flags_cxx("-Wno-error=global-constructors -Wno-implicit-fallthrough") - add_flags_cxx("-Wno-error=extra-semi -Wno-weak-vtables -Wno-switch-enum") + add_flags_cxx("-Wno-error=shadow -Wno-error=old-style-cast -Wno-error=global-constructors") + add_flags_cxx("-Wno-error=exit-time-destructors") + add_flags_cxx("-Wno-weak-vtables -Wno-switch-enum") + if (CLANG_VERSION_STRING VERSION_MORE 3.0) + # flags that are not present in 3.0 + add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=missing-variable-declarations") + add_flags_cxx("-Wno-implicit-fallthrough -Wno-error=extra-semi") + endif() + if (CLANG_VERSION_STRING VERSION_MORE 3.1) + # flags introduced in 3.2 + add_flags_cxx("-Wno-documentation") + endif() endif() endif() -- cgit v1.2.3 From 8b5ad667d90fa8dc69ef8b1849e3fe426d8a04eb Mon Sep 17 00:00:00 2001 From: worktycho Date: Sat, 6 Sep 2014 14:49:40 +0100 Subject: Improve error message --- SetFlags.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SetFlags.cmake b/SetFlags.cmake index 7d845ebb7..cd1eaa3d6 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -223,8 +223,8 @@ macro(set_exe_flags) add_flags_cxx("-ffast-math") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - if (CLANG_VERSION_STRING VERSION_LESS 3.0) - message(FATAL_ERROR "MCServer requires clang version 3.0 or higher") + if ("${CLANG_VERSION_STRING}" VERSION_LESS 3.0) + message(FATAL_ERROR "MCServer requires clang version 3.0 or higher, version is ${CLANG_VERSION_STRING}") endif() # clang does not provide the __extern_always_inline macro and a part of libm depends on this when using fast-math add_flags_cxx("-D__extern_always_inline=inline") -- cgit v1.2.3 From f7d06f093e2303336ab686a2b2d2bcd1debe101a Mon Sep 17 00:00:00 2001 From: worktycho Date: Sat, 6 Sep 2014 14:55:06 +0100 Subject: Wrong cmake var --- SetFlags.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SetFlags.cmake b/SetFlags.cmake index cd1eaa3d6..69a9a59a0 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -223,8 +223,8 @@ macro(set_exe_flags) add_flags_cxx("-ffast-math") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - if ("${CLANG_VERSION_STRING}" VERSION_LESS 3.0) - message(FATAL_ERROR "MCServer requires clang version 3.0 or higher, version is ${CLANG_VERSION_STRING}") + if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3.0) + message(FATAL_ERROR "MCServer requires clang version 3.0 or higher, version is ${CMAKE_CXX_COMPILER_VERSION}") endif() # clang does not provide the __extern_always_inline macro and a part of libm depends on this when using fast-math add_flags_cxx("-D__extern_always_inline=inline") -- cgit v1.2.3 From 5fa206a4208b64b4a536bf7e2ab49affc56500d4 Mon Sep 17 00:00:00 2001 From: Tycho Date: Sat, 6 Sep 2014 15:30:13 +0100 Subject: bumped cmake version min and fixed clang support --- CMakeLists.txt | 2 +- SetFlags.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd9b1e67c..a00ed84c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.2) +cmake_minimum_required (VERSION 2.8.10) # Without this, the MSVC variable isn't defined for MSVC builds ( http://www.cmake.org/pipermail/cmake/2011-November/047130.html ) enable_language(CXX C) diff --git a/SetFlags.cmake b/SetFlags.cmake index 69a9a59a0..476a15516 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -236,12 +236,12 @@ macro(set_exe_flags) add_flags_cxx("-Wno-error=shadow -Wno-error=old-style-cast -Wno-error=global-constructors") add_flags_cxx("-Wno-error=exit-time-destructors") add_flags_cxx("-Wno-weak-vtables -Wno-switch-enum") - if (CLANG_VERSION_STRING VERSION_MORE 3.0) + if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER 3.0) # flags that are not present in 3.0 add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=missing-variable-declarations") add_flags_cxx("-Wno-implicit-fallthrough -Wno-error=extra-semi") endif() - if (CLANG_VERSION_STRING VERSION_MORE 3.1) + if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER 3.1) # flags introduced in 3.2 add_flags_cxx("-Wno-documentation") endif() -- cgit v1.2.3 From 562b2d1d1de7438bc763d778b56b0743affd1b5b Mon Sep 17 00:00:00 2001 From: Tycho Date: Sat, 6 Sep 2014 16:30:04 +0100 Subject: Added workaround for clang version --- CMakeLists.txt | 2 +- SetFlags.cmake | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a00ed84c6..4c47eb509 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.10) +cmake_minimum_required (VERSION 2.8.7) # Without this, the MSVC variable isn't defined for MSVC builds ( http://www.cmake.org/pipermail/cmake/2011-November/047130.html ) enable_language(CXX C) diff --git a/SetFlags.cmake b/SetFlags.cmake index 476a15516..34862308f 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -205,6 +205,16 @@ macro(enable_profile) endif() 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) + message(${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) # 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 @@ -223,8 +233,9 @@ macro(set_exe_flags) add_flags_cxx("-ffast-math") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3.0) - message(FATAL_ERROR "MCServer requires clang version 3.0 or higher, version is ${CMAKE_CXX_COMPILER_VERSION}") + get_clang_version() + if ("${CLANG_VERSION}" VERSION_LESS 3.0) + message(FATAL_ERROR "MCServer requires clang version 3.0 or higher, version is ${CLANG_VERSION}") endif() # clang does not provide the __extern_always_inline macro and a part of libm depends on this when using fast-math add_flags_cxx("-D__extern_always_inline=inline") @@ -236,12 +247,12 @@ macro(set_exe_flags) add_flags_cxx("-Wno-error=shadow -Wno-error=old-style-cast -Wno-error=global-constructors") add_flags_cxx("-Wno-error=exit-time-destructors") add_flags_cxx("-Wno-weak-vtables -Wno-switch-enum") - if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER 3.0) + if ("${CLANG_VERSION}" VERSION_GREATER 3.0) # flags that are not present in 3.0 add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=missing-variable-declarations") add_flags_cxx("-Wno-implicit-fallthrough -Wno-error=extra-semi") endif() - if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER 3.1) + if ("${CLANG_VERSION}" VERSION_GREATER 3.1) # flags introduced in 3.2 add_flags_cxx("-Wno-documentation") endif() -- cgit v1.2.3 From 22b45116408016a4ecc43d85280501401a99c796 Mon Sep 17 00:00:00 2001 From: worktycho Date: Sat, 6 Sep 2014 18:11:42 +0100 Subject: Update SetFlags.cmake --- SetFlags.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/SetFlags.cmake b/SetFlags.cmake index 34862308f..0835189ad 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -210,7 +210,6 @@ macro(get_clang_version) execute_process( COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE CLANG_VERSION_OUTPUT) - message(${CLANG_VERSION_OUTPUT}) string(REGEX MATCH "version ([0-9]\\.[0-9])" x ${CLANG_VERSION_OUTPUT}) set(CLANG_VERSION ${CMAKE_MATCH_1}) endmacro() -- cgit v1.2.3