From 77f1f58c0a7eb55001b375f1945690ed5c1e87a2 Mon Sep 17 00:00:00 2001 From: tycho Date: Tue, 19 May 2015 19:32:10 +0100 Subject: Make -Werror disabling file only Ad fix a load of warnings --- SetFlags.cmake | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'SetFlags.cmake') diff --git a/SetFlags.cmake b/SetFlags.cmake index 0d1bd99b3..b26796522 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -16,8 +16,8 @@ macro (add_flags_lnk FLAGS) endmacro() macro(add_flags_cxx FLAGS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}") + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") + #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAGS}") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAGS}") set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} ${FLAGS}") @@ -235,7 +235,7 @@ macro(set_exe_flags) string(REPLACE "-w" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") string(REPLACE "-w" "" CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE}") string(REPLACE "-w" "" CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_COVERAGE}") - add_flags_cxx("-Wall -Wextra -Wno-unused-parameter -Wno-error=switch") + add_flags_cxx("-Wall -Wextra -Wno-unused-parameter") # we support non-IEEE 754 fpus so can make no guarentees about error add_flags_cxx("-ffast-math") @@ -248,16 +248,10 @@ macro(set_exe_flags) # 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-exit-time-destructors -Wno-padded") - add_flags_cxx("-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=deprecated") - add_flags_cxx("-Wno-error=missing-prototypes") - add_flags_cxx("-Wno-error=shadow -Wno-error=old-style-cast -Wno-error=global-constructors") - add_flags_cxx("-Wno-error=float-equal") - add_flags_cxx("-Wno-weak-vtables -Wno-switch-enum") + add_flags_cxx("-Wno-exit-time-destructors -Wno-padded -Wno-weak-vtables") 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") + add_flags_cxx("-Wno-implicit-fallthrough") endif() if ("${CLANG_VERSION}" VERSION_GREATER 3.1) # flags introduced in 3.2 @@ -267,3 +261,21 @@ macro(set_exe_flags) endif() endmacro() + +# if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +# foreach(FILENAME ${ARGN}) +# message("downgrade_warnings for ${FILENAME}") +# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion") +# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=missing-prototypes -Wno-error=deprecated") +# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=shadow -Wno-error=old-style-cast -Wno-error=switch-enum -Wno-error=switch") +# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=float-equal -Wno-error=global-constructors") + +# if ("${CLANG_VERSION}" VERSION_GREATER 3.0) +# # flags that are not present in 3.0 +# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=covered-switch-default ") +# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-implicit-fallthrough -Wno-error=extra-semi") +# set_source_files_properties(${FILENAME} PROPERTIES COMPILE_FLAGS "-Wno-error=missing-variable-declarations") +# endif() +# endforeach() +# endif() + -- cgit v1.2.3 From 7a5c1d30f8f8aaa7ea55463c42fe36e1dda0c6b6 Mon Sep 17 00:00:00 2001 From: tycho Date: Sat, 23 May 2015 11:53:49 +0100 Subject: Added pthread as a link flag. --- SetFlags.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'SetFlags.cmake') diff --git a/SetFlags.cmake b/SetFlags.cmake index b26796522..54b40aabb 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -80,8 +80,9 @@ macro(set_flags) else() # Let gcc / clang know that we're compiling a multi-threaded app: - if (UNIX) + if (${UNIX}) add_flags_cxx("-pthread") + add_flags_lnk("-pthread") endif() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") -- cgit v1.2.3 From dae9e5792a4f030ae9e748548a16a89790fbd311 Mon Sep 17 00:00:00 2001 From: tycho Date: Sun, 24 May 2015 12:56:56 +0100 Subject: Made -Weverything an error. --- SetFlags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'SetFlags.cmake') diff --git a/SetFlags.cmake b/SetFlags.cmake index 2de86090d..c20a45133 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -248,7 +248,7 @@ macro(set_exe_flags) 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("-Weverything -Werror -Wno-c++98-compat-pedantic -Wno-string-conversion") add_flags_cxx("-Wno-exit-time-destructors -Wno-padded -Wno-weak-vtables") if ("${CLANG_VERSION}" VERSION_GREATER 3.0) # flags that are not present in 3.0 -- cgit v1.2.3 From 51b4584b425bbc9c96b4967b9391479768d3cb28 Mon Sep 17 00:00:00 2001 From: tycho Date: Sun, 24 May 2015 15:22:55 +0100 Subject: Fix clang 3.6 flags to only be used in clang 3.6 --- SetFlags.cmake | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'SetFlags.cmake') diff --git a/SetFlags.cmake b/SetFlags.cmake index c20a45133..d824d054a 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -27,6 +27,16 @@ macro(add_flags_cxx FLAGS) 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) # Add coverage processing, if requested: if (NOT MSVC) @@ -113,6 +123,10 @@ macro(set_flags) add_flags_cxx("-march=native") endif() + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + get_clang_version() + endif() + # Use static CRT in MSVC builds: if (MSVC) @@ -215,15 +229,6 @@ 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) - 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 @@ -242,7 +247,6 @@ macro(set_exe_flags) add_flags_cxx("-ffast-math") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - 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() -- cgit v1.2.3 From 5049fd0fbf2fe2e54d86d9d0f704d5daa301f819 Mon Sep 17 00:00:00 2001 From: linnemannr Date: Sun, 24 May 2015 20:07:31 -0600 Subject: Support building on FreeBSD SetFlags.cmake Add -lexecinfo to linker flags for FreeBSD to resolve backtrace() lib/sqlite/CMakeLists.txt Define _XOPEN_SOURCE to 600 instead of __POSIX_VISIBLE to 200112 for POSIX 1-2001 support. For POSIX standards, the _XOPEN_SOURCE define controls the eventual value of __POSIX_VISIBLE. _XOPEN_SOURCE is defined to 500 in sqlite.c if not already defined, which sets up _POSIX_C_SOURCE and __POSIX_VISIBLE to the 199506 for POSIX.1c lib/tolua++/CMakeLists.txt src/CMakeLists.txt Add /usr/local/lib to the library search path for FreeBSD builds src/OSSupport/Errors.cpp Correct the strerror_r() implementation determination to check whether _GNU_SOURCE is defined, not what it evaluates to --- SetFlags.cmake | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'SetFlags.cmake') diff --git a/SetFlags.cmake b/SetFlags.cmake index b05585f7d..92046b688 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -240,6 +240,11 @@ macro(set_exe_flags) # we support non-IEEE 754 fpus so can make no guarentees about error add_flags_cxx("-ffast-math") + if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + # backtrace() and friends are in libexecinfo + add_flags_lnk("-lexecinfo") + endif() + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") get_clang_version() if ("${CLANG_VERSION}" VERSION_LESS 3.0) -- cgit v1.2.3 From d5c89eceb8b5596816a74e5c4ce08b851403f19b Mon Sep 17 00:00:00 2001 From: tycho Date: Sat, 30 May 2015 13:32:22 +0100 Subject: Moved shared cmake flags to the CMAKE_C_FLAGS var --- SetFlags.cmake | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'SetFlags.cmake') diff --git a/SetFlags.cmake b/SetFlags.cmake index e336bd6c8..b79551eef 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -16,14 +16,8 @@ macro (add_flags_lnk FLAGS) endmacro() macro(add_flags_cxx FLAGS) - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") - #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAGS}") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAGS}") - set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} ${FLAGS}") - set(CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_COVERAGE} ${FLAGS}") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${FLAGS}") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}") endmacro() -- cgit v1.2.3