Merge pull request #91 from wllm-rbnt/dbg

Implement compilation options
This commit is contained in:
Alexandre Dulaunoy 2023-09-11 19:49:18 +02:00 committed by GitHub
commit fe8ff451cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,23 @@ project(
LANGUAGES C LANGUAGES C
) )
######## User defined options
option(DEBUG_BUILD "Build with debug facilities" OFF)
option(DISABLE_OPTIMIZATION "Build without compiler optimizations" OFF)
################
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
if(DEBUG_BUILD)
add_definitions(-DDEBUG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb3")
endif()
if(DISABLE_OPTIMIZATION)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
endif()
include(CheckSymbolExists) include(CheckSymbolExists)
include(GNUInstallDirs) include(GNUInstallDirs)