CMake toggle debug mode

Hi Everyone, I am struggling as you can understand from the title with CMake JUCE API and more precisely in compiling turning on/off the debug mode. As far as I know from reading the documentation of jassert this will be not compiled if the debug mode is turned off, which is great but, how do I toggle the debug mode in CMake? I am using this template repository to have a starting point.

Thanks in advance to everyone answering this question :slight_smile:

Hey there,

If you are using CMake to generate an IDE project (like for xcode/visual studio), you toggle it in the IDE. In some cases you might need to add the “build configuration”:

Behind the scenes (or if you are on the command line), the build configuration is just passed to CMake while building.

cmake --build cmake-build-release --config Release

(cmake-build-release would be whatever you want the build directory to be)

I’ll update it to make some of this clearer, but maybe this post can help you:

3 Likes

Hi @sudara
Thx for your answer! I actually am working with VSCode, i do not really like work on XCode. Also I saw your article, but I completely missed the part about the build, thank you so much for helping me figure out this :grin:

1 Like

If you’re using the CMake extension in vscode, you can just click this button on the status bar to choose a build variant:

image

2 Likes