Skip to content

Commit 61408e3

Browse files
committed
cmake: make build type configurable
$ cmake -D CMAKE_BUILD_TYPE=Debug .
1 parent 6bb3d56 commit 61408e3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.github/workflows/cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Configure CMake
3333
env:
3434
CC: ${{ matrix.compiler }}
35-
run: cmake -B ${{github.workspace}}/
35+
run: cmake -D CMAKE_BUILD_TYPE=Debug -B ${{github.workspace}}/
3636

3737
- name: Build
3838
env:

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ endfunction()
1616

1717
# CONFIG
1818

19-
set(CMAKE_BUILD_TYPE "Debug")
20-
#set(CMAKE_BUILD_TYPE "Release")
19+
if(NOT CMAKE_BUILD_TYPE)
20+
set(CMAKE_BUILD_TYPE "Release")
21+
message(STATUS "Setting build type to '${CMAKE_BUILD_TYPE}' as none was specified.")
22+
endif()
2123

2224
set(CMAKE_C_FLAGS "-Wall -Wextra --pedantic -Wno-strict-aliasing -Wno-variadic-macros")
2325
set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")

0 commit comments

Comments
 (0)