It doesn't look like it's documented, at least in the command line --help-variable.
It's a special case, which I think works for a lot of the build flag related cache variables (though for a lot of the others, you probably need to put values in e.g. a c_flag_overrides.cmake included by setting CMAKE_USER_MAKE_RULES_OVERRIDE so they can be dependent on detected platform/compiler settings). -- Daniel Schepler ________________________________________ From: daniel.r.ke...@gmail.com [daniel.r.ke...@gmail.com] on behalf of Dan Kegel [d...@kegel.com] Sent: Friday, July 31, 2015 10:21 AM To: Daniel Schepler Cc: cmake Subject: Re: [CMake] [cmake-developers] CMake IR On Fri, Jul 31, 2015 at 11:44 AM, Daniel Schepler <dschep...@scalable-networks.com> wrote: >> Here's another example from real life. Maybe I'm just being an idiot, >> but this is what I had to do to set a default: >> >> IF(DEFINED CMAKE_BUILD_TYPE AND (NOT ${CMAKE_BUILD_TYPE} STREQUAL "None")) >> SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the >> type of build, options are: Debug Release RelWithDebInfo") >> ELSE() >> SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type >> of build, options are: Debug Release RelWithDebInfo" FORCE) >> ENDIF() >> >> Can someone give me the proper one-line way to set a default for >> CMAKE_BUILD_TYPE, or is this an authentic problem? > > This seems to work for me: > set(CMAKE_BUILD_TYPE_INIT RelWithDebInfo) Wow, never heard of that variable, thanks Is that documented? Can you just slam _INIT on the end of any cache variable to give it a default value, or is that a special case? - Dan -- 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