mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
cmake: add the GCC_OPTIMIZATION_FLAGS variable
Instead of always adding -O2 for CMAKE_C_FLAGS_DEBUG and CMAKE_CXX_FLAGS_DEBUG allow the user to pass a custom value via GCC_OPTIMIZATION_FLAGS. Passing -DGCC_OPTIMIZATION_FLAGS:STRING=-O0 would disable all optimizations. Suggested-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
81a812539c
commit
a0b80ca775
1 changed files with 5 additions and 3 deletions
|
@ -105,9 +105,11 @@ endif()
|
|||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
|
||||
# optimize -O2 even for debug builds
|
||||
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O2")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2")
|
||||
# by detault optimize with -O2 even for debug builds
|
||||
set (GCC_OPTIMIZATION_FLAGS "-O2" CACHE STRING "GCC optimization flags")
|
||||
message (STATUS "GCC optimization flags: " ${GCC_OPTIMIZATION_FLAGS})
|
||||
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${GCC_OPTIMIZATION_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${GCC_OPTIMIZATION_FLAGS}")
|
||||
|
||||
# pkgconfig for required libraries
|
||||
find_package(PkgConfig)
|
||||
|
|
Loading…
Reference in a new issue