Hi,

Am 01.08.2017 um 16:59 schrieb J Decker:
> I like having something like this.... defines CMAKE_BUILD_TYPE to be a 
> droplist of choices...
> 
> ----
> 
> if( NOT CMAKE_CONFIGURATION_TYPES )
> set( CMAKE_CONFIGURATION_TYPES debug release )
> endif( NOT CMAKE_CONFIGURATION_TYPES )
> 
> set( CMAKE_BUILD_TYPE release CACHE STRING "Cached cmake build type"  )
> set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 
> ${CMAKE_CONFIGURATION_TYPES} )

The droplist is really cool! Can't understand why it's not the default this way.

https://cmake.org/cmake/help/v3.0/variable/CMAKE_CONFIGURATION_TYPES.html says 
"This has reasonable defaults on most
platforms...", but when I message(${CMAKE_CONFIGURATION_TYPES}) it is empty. 
Why that?

That code also does not seem to set the default:

if(NOT CMAKE_CONFIGURATION_TYPES)
  set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo)
endif()

set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build Type")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 
${CMAKE_CONFIGURATION_TYPES} )

So the first commands set the cached value of the string "Build type". The 
second commands sets the property STRINGS of
the variable CMAKE_BUILD_TYPE. Is that correct?


# if (NOT CMAKE_BUILD_TYPE)
#   set(CMAKE_BUILD_TYPE Debug)

Uncommenting this sets the default non builds with cmake, but not on ccmake (at 
least not in the GUI).

# endif()
message(STATUS "Build configuration: " ${CMAKE_BUILD_TYPE})


Best Thanks,
Florian

> 
> 
> -----
> 
> https://cmake.org/cmake/help/v3.0/variable/CMAKE_CONFIGURATION_TYPES.html
> 
> On Mon, Jul 31, 2017 at 9:28 PM, Michael Ellery <mellery...@gmail.com 
> <mailto:mellery...@gmail.com>> wrote:
> 
> 
> 
>     > On Jul 31, 2017, at 8:48 PM, Florian Lindner <mailingli...@xgm.de 
> <mailto:mailingli...@xgm.de>> wrote:
>     >
>     > Hello
>     >
>     > ccmake shows CMAKE_BUILD_TYPE as unset. From the compile commands it 
> looks like also nothing like Debug nor Release.
>     >
>     > Why is there no well-defined default set? How can I set a default?
>     >
>     > Thanks,
>     > Florian
>     > --
>     >
>     > Powered by www.kitware.com <http://www.kitware.com>
>     >
>     > Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
>     <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 
> <http://cmake.org/cmake/help/support.html>
>     > CMake Consulting: http://cmake.org/cmake/help/consulting.html 
> <http://cmake.org/cmake/help/consulting.html>
>     > CMake Training Courses: http://cmake.org/cmake/help/training.html 
> <http://cmake.org/cmake/help/training.html>
>     >
>     > Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>     <http://www.kitware.com/opensource/opensource.html>
>     >
>     > Follow this link to subscribe/unsubscribe:
>     > http://public.kitware.com/mailman/listinfo/cmake 
> <http://public.kitware.com/mailman/listinfo/cmake>
> 
> 
>     my recollection is that an unspecified build type results in a build that 
> has no optimizations and no debug symbols
>     generated. I’m not sure what the motivation for those default flags is. 
> If you want to default to DEBUG, something
>     like this should work:
> 
>         if (NOT CMAKE_BUILD_TYPE)
>           set(CMAKE_BUILD_TYPE Debug)
>         endif()
> 
> 
>     -MIke
> 
>     --
> 
>     Powered by www.kitware.com <http://www.kitware.com>
> 
>     Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
>     <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 
> <http://cmake.org/cmake/help/support.html>
>     CMake Consulting: http://cmake.org/cmake/help/consulting.html 
> <http://cmake.org/cmake/help/consulting.html>
>     CMake Training Courses: http://cmake.org/cmake/help/training.html 
> <http://cmake.org/cmake/help/training.html>
> 
>     Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>     <http://www.kitware.com/opensource/opensource.html>
> 
>     Follow this link to subscribe/unsubscribe:
>     http://public.kitware.com/mailman/listinfo/cmake 
> <http://public.kitware.com/mailman/listinfo/cmake>
> 
> 
-- 

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

Reply via email to