From faecff570c48350c599bcf043a7004a52ddf1b39 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 28 Apr 2022 20:26:54 +0200 Subject: Enable additional warning flags also make them work with the RelWithDebInfo build type --- src/CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0323603fc..f9ec419e9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -693,14 +693,13 @@ if(MSVC) endif() else() # GCC or compatible compilers such as Clang + set(WARNING_FLAGS "-Wall -Wextra") + set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-parameter -Wno-implicit-fallthrough") if(WARN_ALL) - set(RELEASE_WARNING_FLAGS "-Wall") + set(RELEASE_WARNING_FLAGS "${WARNING_FLAGS}") else() set(RELEASE_WARNING_FLAGS "") endif() - if(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang") - set(WARNING_FLAGS "${WARNING_FLAGS} -Wsign-compare") - endif() if(APPLE AND USE_LUAJIT) # required per http://luajit.org/install.html @@ -742,7 +741,7 @@ else() endif() endif() - set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${WARNING_FLAGS} ${OTHER_FLAGS} -Wall -pipe -funroll-loops") + set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${OTHER_FLAGS} -pipe -funroll-loops") if(CMAKE_SYSTEM_NAME MATCHES "(Darwin|BSD|DragonFly)") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os") else() @@ -755,8 +754,9 @@ else() set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MATH_FLAGS}") endif() endif() - set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 -Wall ${WARNING_FLAGS} ${OTHER_FLAGS}") - set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall ${WARNING_FLAGS} ${OTHER_FLAGS}") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -g") + set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 ${WARNING_FLAGS} ${OTHER_FLAGS}") + set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 ${WARNING_FLAGS} ${OTHER_FLAGS}") if(USE_GPROF) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") -- cgit v1.2.3