Search code examples
c++cmakecmake-gui

Modifying variables in cmake-gui


Here is said that to run cmake for each builds (debug and release) it is recommended to pass CMAKE_BUILD_TYPE as an argument to cmake, e.g. cmake -DCMAKE_BUILD_TYPE=Release .. or cmake -DCMAKE_BUILD_TYPE=Debug .. What is the equivalent of this in cmake-gui? When I press "Configure" then some variables pops-up in window and here I will create new one CMAKE_BUILD_TYPE=Debug and then press "Generate" is this equivalent of above mentioned command line passing?

Thanks


Solution

  • Yes. It is equivalent.

    Note that CMAKE_BUILD_TYPE only works for single-configuration generators like Unix Makefiles. Generators like Visual Studio generate multi-configuration projects and the choice of the one being compiled is done in the IDE.

    EDIT: As stated in comments, and unlike what I suggested below, CMAKE_BUILD_TYPE is not an advanced variable, and effectively needs to be added in the GUI.

    Not sure, but CMAKE_BUILD_TYPE may already exists as an advanced option: check the "Advanced" checkbox in the GUI to show all the variables.