1

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

Community
  • 1
  • 1
Wakan Tanka
  • 7,542
  • 16
  • 69
  • 122

1 Answers1

3

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.

rocambille
  • 15,398
  • 12
  • 50
  • 68
  • Thank you for your reply. FYI: CMAKE_BUILD_TYPE is not available under "Advanced". I've also tried to pass -DCMAKE_BUILD_TYPE="Debug" to cmake-gui but seems that it does not recognize it and only way is to modify variables from GUI. Your note about single-configurations and multi-configurations shines a light to my another question here http://stackoverflow.com/questions/39401044/proper-way-to-compile-project-with-debug-symbols-and-cmake – Wakan Tanka Sep 09 '16 at 09:00
  • Thank you again. Also comes to my mind that e.g. `CMAKE_INSTALL_PREFIX` is probably useless when Visual Studio is used as configuration generator. Are there some list of variables that should be avoided e.g. for Visual Studio? Thank you. – Wakan Tanka Sep 09 '16 at 09:31
  • `CMAKE_INSTALL_PREFIX` is not useless when Visual Studio is used as configuration generator: it is used by the `INSTALL` project generated with the solution. AFAIK There is no real list of the variables unused by the Visual Studio generator. Variables related to Unix or OSX are de facto useless for Visual for examples, but they will just be ignored during generation so there is no reason to avoid them at all – rocambille Sep 09 '16 at 09:58