# How to be able to choose Debug or Release build in CMake

**URL:** https://discourse.cmake.org/t/how-to-be-able-to-choose-debug-or-release-build-in-cmake/15727
**Category:** Usage
**Tags:** os:windows, gen:ninja
**Created:** [June 23, 2026, 3:57pm UTC](https://discourse.cmake.org/t/how-to-be-able-to-choose-debug-or-release-build-in-cmake/15727 "2026-06-23T15:57:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Maaz\_Madha](https://discourse.cmake.org/user_avatar/discourse.cmake.org/maaz_madha/32/5927_2.png) [@Maaz\_Madha](https://discourse.cmake.org/u/Maaz_Madha)
#### Post date: [June 23, 2026, 3:57pm UTC](https://discourse.cmake.org/t/how-to-be-able-to-choose-debug-or-release-build-in-cmake/15727/1 "2026-06-23T15:57:48Z")

</div>

Hi all

How do I configure build or debug releases for a multi directory project, cross compiling project with CMakeLists.txt for each of the directories. Do I do this in CMakePresets.json or pass it as a command, and if so how? Or do I make chnges in my app directory or in my root CMakeLists, the one where all the other directories are added as subdirectories?

Kind regards

---

<div class="post-metadata">

### Author: ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)
#### Post date: [June 25, 2026, 3:17pm UTC](https://discourse.cmake.org/t/how-to-be-able-to-choose-debug-or-release-build-in-cmake/15727/2 "2026-06-25T15:17:46Z")

</div>

The way to select a configuration (e.g. Debug, Release) when running CMake with a single-config generator (such as Ninja) is to define the CMake variable [`CMAKE_BUILD_TYPE`](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html) to the desired value. This can be done in the CMake UI you are using, or on the CMake command line with `-DCMAKE_BUILD_TYPE=Debug`. It can also be set in a preset.
