<div dir="ltr">It depends on the Generator.<div><br></div><div>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.</div><div><br></div><div>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} .</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 2, 2017 at 1:57 PM, Florian Lindner <span dir="ltr"><<a href="mailto:mailinglists@xgm.de" target="_blank">mailinglists@xgm.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<span class=""><br>
Am 01.08.2017 um 16:59 schrieb J Decker:<br>
> I like having something like this.... defines CMAKE_BUILD_TYPE to be a droplist of choices...<br>
><br>
> ----<br>
><br>
> if( NOT CMAKE_CONFIGURATION_TYPES )<br>
> set( CMAKE_CONFIGURATION_TYPES debug release )<br>
> endif( NOT CMAKE_CONFIGURATION_TYPES )<br>
><br>
> set( CMAKE_BUILD_TYPE release CACHE STRING "Cached cmake build type"  )<br>
> set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )<br>
<br>
</span>The droplist is really cool! Can't understand why it's not the default this way.<br>
<br>
<a href="https://cmake.org/cmake/help/v3.0/variable/CMAKE_CONFIGURATION_TYPES.html" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/<wbr>v3.0/variable/CMAKE_<wbr>CONFIGURATION_TYPES.html</a> says "This has reasonable defaults on most<br>
platforms...", but when I message(${CMAKE_CONFIGURATION_<wbr>TYPES}) it is empty. Why that?<br>
<br>
That code also does not seem to set the default:<br>
<br>
if(NOT CMAKE_CONFIGURATION_TYPES)<br>
  set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo)<br>
endif()<br>
<br>
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build Type")<br>
<span class="">set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )<br>
<br>
</span>So the first commands set the cached value of the string "Build type". The second commands sets the property STRINGS of<br>
the variable CMAKE_BUILD_TYPE. Is that correct?<br>
<br>
<br>
# if (NOT CMAKE_BUILD_TYPE)<br>
#   set(CMAKE_BUILD_TYPE Debug)<br>
<br>
Uncommenting this sets the default non builds with cmake, but not on ccmake (at least not in the GUI).<br>
<br>
# endif()<br>
message(STATUS "Build configuration: " ${CMAKE_BUILD_TYPE})<br>
<br>
<br>
Best Thanks,<br>
Florian<br>
<br>
><br>
><br>
> -----<br>
><br>
> <a href="https://cmake.org/cmake/help/v3.0/variable/CMAKE_CONFIGURATION_TYPES.html" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/<wbr>v3.0/variable/CMAKE_<wbr>CONFIGURATION_TYPES.html</a><br>
><br>
> On Mon, Jul 31, 2017 at 9:28 PM, Michael Ellery <<a href="mailto:mellery451@gmail.com">mellery451@gmail.com</a> <mailto:<a href="mailto:mellery451@gmail.com">mellery451@gmail.com</a>>> wrote:<br>
<span class="">><br>
><br>
><br>
>     > On Jul 31, 2017, at 8:48 PM, Florian Lindner <<a href="mailto:mailinglists@xgm.de">mailinglists@xgm.de</a> <mailto:<a href="mailto:mailinglists@xgm.de">mailinglists@xgm.de</a>>> wrote:<br>
>     ><br>
>     > Hello<br>
>     ><br>
>     > ccmake shows CMAKE_BUILD_TYPE as unset. From the compile commands it looks like also nothing like Debug nor Release.<br>
>     ><br>
>     > Why is there no well-defined default set? How can I set a default?<br>
>     ><br>
>     > Thanks,<br>
>     > Florian<br>
>     > --<br>
>     ><br>
</span>>     > Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com" rel="noreferrer" target="_blank">http://www.kitware.com</a>><br>
<span class="">>     ><br>
>     > Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
>     <<a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a>><br>
>     ><br>
>     > Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
>     ><br>
</span>>     > CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a> <<a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a>><br>
>     > CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a> <<a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a>><br>
>     > CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a> <<a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a>><br>
<span class="">>     ><br>
>     > Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
>     <<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a>><br>
>     ><br>
>     > Follow this link to subscribe/unsubscribe:<br>
</span>>     > <a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a> <<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a>><br>
<span class="">><br>
><br>
>     my recollection is that an unspecified build type results in a build that has no optimizations and no debug symbols<br>
>     generated. I’m not sure what the motivation for those default flags is. If you want to default to DEBUG, something<br>
>     like this should work:<br>
><br>
>         if (NOT CMAKE_BUILD_TYPE)<br>
>           set(CMAKE_BUILD_TYPE Debug)<br>
>         endif()<br>
><br>
><br>
>     -MIke<br>
><br>
>     --<br>
><br>
</span>>     Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com" rel="noreferrer" target="_blank">http://www.kitware.com</a>><br>
<span class="">><br>
>     Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
>     <<a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a>><br>
><br>
>     Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
><br>
</span>>     CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a> <<a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a>><br>
>     CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a> <<a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a>><br>
>     CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a> <<a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a>><br>
<span class="">><br>
>     Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
>     <<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a>><br>
><br>
>     Follow this link to subscribe/unsubscribe:<br>
</span>>     <a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a> <<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a>><br>
<div class="HOEnZb"><div class="h5">><br>
><br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a></div></div></blockquote></div><br></div>