From: Bastian Dehn Date: Sun, 14 Apr 2024 06:02:17 +0000 (+0200) Subject: add build with debug symboles X-Git-Tag: v1.0.0^2~14 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=72bee0bd2826d7c623b3d8df4c818e0a067c81d1;p=sane-kds-s2000w-net.git add build with debug symboles --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e512ec..3f5204a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,18 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.25.1) -SET(CMAKE_C_COMPILER gcc CACHE STRING "compiler") -IF (NOT RUN_TESTS) - SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "release" FORCE) +SET(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "release") + +IF(CMAKE_BUILD_TYPE STREQUAL "RELEASE") SET(CMAKE_C_FLAGS "-Wall -Werror" CACHE STRING "compiler flags" FORCE) -ELSE() - SET(CMAKE_BUILD_TYPE "DEBUG" CACHE STRING "release" FORCE) +ENDIF() + +IF(CMAKE_BUILD_TYPE STREQUAL "DEBUG") + SET(CMAKE_C_FLAGS "-Wall -g" CACHE STRING "debug compiler flags" FORCE) +ENDIF() + +SET(CMAKE_C_COMPILER gcc CACHE STRING "compiler") +IF (RUN_TESTS) + SET(CMAKE_BUILD_TYPE "DEBUG" CACHE STRING "debug" FORCE) SET(CMAKE_C_FLAGS "-fPIC \ -fprofile-arcs \ -ftest-coverage \ diff --git a/readme.md b/readme.md index d2d57c7..7a3c16f 100644 --- a/readme.md +++ b/readme.md @@ -66,4 +66,11 @@ build with tests and run it ```bash cmake -DRUN_TESTS=on .. make +``` + +build with debug symboles + +```bash +cmake -DCMAKE_BUILD_TYPE=DEBUG .. +make ``` \ No newline at end of file