[CMake] What is the default build type?

David Cole DLRdave at aol.com
Wed Aug 2 13:32:01 EDT 2017


Very cool, Marcus. Thanks for the blog post.

Florian, when you "message(${CMAKE_CONFIGURATION_TYPES})" it is empty
because you are using a single-configuration CMake generator. Only
Visual Studio and Xcode (and possibly other) **multi** config
generators have a list of values in CMAKE_CONFIGURATION_TYPES.
Contrary to the previous recommendation, I would NOT recommend setting
it to a list in a single configuration generator. If you're using a
multi-config generator, you can set up a subset for it to use with
this, but in a single config generator, this variable SHOULD be empty,
and you should not give it contents in that case.


HTH,
David C.



On Wed, Aug 2, 2017 at 11:55 AM, Marcus D. Hanwell
<marcus.hanwell at kitware.com> wrote:
> On Wed, Aug 2, 2017 at 3:03 AM, Bo Zhou <bo.schwarzstein at gmail.com> wrote:
>>
>> It depends on the Generator.
>>
>> To the Makefile, the actual type was controlled by the compiler options.
>> If you don't specific any type, usually it means non-debug and
>> non-optimization because the CMAKE_CXX_FLAGS is empty as default. This is
>> critical, so usually people should specific the actual type they want to
>> build.
>>
>> To the generator of the IDE, such as Visual Studio and Xcode, the
>> CMAKE_BUILD_TYPE doesn't make sense but we have to use
>> CMAKE_CONFIGURATION_TYPES, then CMake will create the several configuration
>> sets for the IDE from the CMAKE_C|CXX_FLAGS_{CONFIG} .
>
>
> This thread inspired me to write up how we have been doing it in some of the
> projects I work on for quite a while now,
>
> https://blog.kitware.com/cmake-and-the-default-build-type/
>
> It certainly isn't the only way, but it provides an easy path to ensure
> things show up in the GUIs, respect build types passed in, etc.
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list