<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 5/11/2012 5:30 PM, Jean-Christophe Fillion-Robin wrote:
<blockquote
cite="mid:CANLz8R78hwQDAdBqAtsKht0HzMHvpvcs=1FgFHzH-1mij0GGPw@mail.gmail.com"
type="cite">Hi Eric,
<div><br>
</div>
<div>In our different projects, we use an approach similar to this
one:</div>
<div><br>
</div>
<div>
<pre style="word-wrap:break-word;white-space:pre-wrap"># 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()</pre>
</div>
<div><br>
</div>
<div><br>
</div>
<div>See <a moz-do-not-send="true"
href="http://vtk.org/gitweb?p=VTK.git;a=blob;f=CMakeLists.txt;h=a57fd66ef333fc26bf74fe658c88c3c634f54c3a;hb=HEAD#l12">http://vtk.org/gitweb?p=VTK.git;a=blob;f=CMakeLists.txt;h=a57fd66ef333fc26bf74fe658c88c3c634f54c3a;hb=HEAD#l12</a></div>
<div><br>
<br>
Hth</div>
<div>Jc</div>
<div><br>
<div class="gmail_quote">On Fri, May 11, 2012 at 11:21 AM,
pellegrini <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:pellegrini@ill.fr" target="_blank">pellegrini@ill.fr</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
when cmake is run without specifying the build type using -D
CMAKE_BUILD_TYPE, it is the Debug mode that is selected as<br>
the default. I would like to find a way to use Release as
the default value when the user does not specify any build<br>
type in the cmake command line.<br>
<br>
From one of my previous post concerning CMAKE_INSTALL_PREFIX
variable, I was thinking to use a similar approach i.e.:<br>
<br>
project(Foo)<br>
<br>
if (CMAKE_BUILD_TYPE_INITIALIZED_TO_DEFAULT)<br>
set(CMAKE_BUILD_TYPE Release)<br>
endif<br>
<br>
but cmake still sets CMAKE_BUILD_TYPE to Debug in the
CMakeCache.txt file.<br>
<br>
Would you have any idea about what is wrong with my
implementation ?<br>
<br>
thanks a lot.<br>
<br>
Eric<br>
--<br>
<br>
Powered by <a moz-do-not-send="true"
href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a
moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html"
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a
moz-do-not-send="true"
href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://www.cmake.org/mailman/listinfo/cmake"
target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
+1 919 869 8849<br>
<br>
</div>
</blockquote>
Hi Jean-Christophe,<br>
<br>
I found a hack for my problem. First it seems to be a windows
specific problem (I found one other message that <br>
mention this).<br>
<br>
What I did is just to put the following before (compulsory) the
project declaration:<br>
<br>
if (NOT DEFINED CMAKE_BUILD_TYPE)<br>
set(CMAKE_BUILD_TYPE CACHE Release STRING "hfsfhskj" FORCE)<br>
endif()<br>
<br>
It would be interesting to get the feedback of the CMake team about
the "uglyness" of such a hack.<br>
<br>
Bye<br>
<br>
Eric<br>
</body>
</html>