Enable additional warning flags

also make them work with the RelWithDebInfo build type
This commit is contained in:
sfan5 2022-04-28 20:26:54 +02:00
parent 828461c193
commit faecff570c

@ -693,14 +693,13 @@ if(MSVC)
endif() endif()
else() else()
# GCC or compatible compilers such as Clang # 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) if(WARN_ALL)
set(RELEASE_WARNING_FLAGS "-Wall") set(RELEASE_WARNING_FLAGS "${WARNING_FLAGS}")
else() else()
set(RELEASE_WARNING_FLAGS "") set(RELEASE_WARNING_FLAGS "")
endif() endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang")
set(WARNING_FLAGS "${WARNING_FLAGS} -Wsign-compare")
endif()
if(APPLE AND USE_LUAJIT) if(APPLE AND USE_LUAJIT)
# required per http://luajit.org/install.html # required per http://luajit.org/install.html
@ -742,7 +741,7 @@ else()
endif() endif()
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)") if(CMAKE_SYSTEM_NAME MATCHES "(Darwin|BSD|DragonFly)")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os")
else() else()
@ -755,8 +754,9 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MATH_FLAGS}") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MATH_FLAGS}")
endif() endif()
endif() endif()
set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 -Wall ${WARNING_FLAGS} ${OTHER_FLAGS}") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -g")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall ${WARNING_FLAGS} ${OTHER_FLAGS}") 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) if(USE_GPROF)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg")