Hi Eric, Considering the fact Visual Studio is a multi-configuration system, I don't think using "CMAKE_BUILD_TYPE" is what you want. Indeed, in such case, the build type is know at build time only. See [1]
Hth Jc [1] http://www.cmake.org/cmake/help/v2.8.8/cmake.html#variable:CMAKE_CFG_INTDIR On Mon, May 14, 2012 at 11:16 AM, pellegrini <pellegr...@ill.fr> wrote: > On 5/11/2012 5:30 PM, Jean-Christophe Fillion-Robin wrote: > > Hi Eric, > > In our different projects, we use an approach similar to this one: > > # Set a default build type if none was specified > if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) > message(STATUS "Setting build type to 'Debug' as none was specified.") > set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) > # Set the possible values of build type for cmake-gui > set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" > "MinSizeRel" "RelWithDebInfo") > endif() > > > > See > http://vtk.org/gitweb?p=VTK.git;a=blob;f=CMakeLists.txt;h=a57fd66ef333fc26bf74fe658c88c3c634f54c3a;hb=HEAD#l12 > > > Hth > Jc > > On Fri, May 11, 2012 at 11:21 AM, pellegrini <pellegr...@ill.fr> wrote: > >> Hi all, >> >> when cmake is run without specifying the build type using -D >> CMAKE_BUILD_TYPE, it is the Debug mode that is selected as >> the default. I would like to find a way to use Release as the default >> value when the user does not specify any build >> type in the cmake command line. >> >> From one of my previous post concerning CMAKE_INSTALL_PREFIX variable, I >> was thinking to use a similar approach i.e.: >> >> project(Foo) >> >> if (CMAKE_BUILD_TYPE_INITIALIZED_TO_DEFAULT) >> set(CMAKE_BUILD_TYPE Release) >> endif >> >> but cmake still sets CMAKE_BUILD_TYPE to Debug in the CMakeCache.txt file. >> >> Would you have any idea about what is wrong with my implementation ? >> >> thanks a lot. >> >> Eric >> -- >> >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Follow this link to subscribe/unsubscribe: >> http://www.cmake.org/mailman/listinfo/cmake >> > > > > -- > +1 919 869 8849 > > Hi Jean-Christophe, > > I found a hack for my problem. First it seems to be a windows specific > problem (I found one other message that > mention this). > > What I did is just to put the following before (compulsory) the project > declaration: > > if (NOT DEFINED CMAKE_BUILD_TYPE) > set(CMAKE_BUILD_TYPE CACHE Release STRING "hfsfhskj" FORCE) > endif() > > It would be interesting to get the feedback of the CMake team about the > "uglyness" of such a hack. > > Bye > > Eric > -- +1 919 869 8849
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake