How to change the build type to Release mode in cmake?

To change the build type, on Windows, it must be done at build time:

cmake --build {DIR} --config Release

By default it’s Debug. I’m still looking for a way of changing this default. CMAKE_BUILD_TYPE doesn’t work of course, and tweaking CMAKE_CONFIGURATION_TYPES doesn’t work either, obviously for the same reason, they only apply for Unix makefiles, not for Visual projects.

Leave a Comment