free-language / box2d

Automatically exported from code.google.com/p/box2d
0 stars 0 forks source link

Default cmake build (and install !!) configuration is debug. #179

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
cmake .
make
make install

What is the expected output? What do you see instead?
Box2D is built and installed as a debug library. It should really default to 
release or build separate release/debug libraries.

What version of the product are you using? On what operating system?
2.1.2 as well as trunk. Really only a problem when not generating a project 
file from cmake as it's obvious which setting you would be picking in an IDE.

Please provide any additional information below.
In order to enable the release configuration, you have to do "cmake 
-DCMAKE_BUILD_TYPE=Release" which is completely non-obvious to cmake newbies. I 
didn't see anything mentioned in the readme or docs anywhere either.

Original issue reported on code.google.com by slemb...@gmail.com on 25 Feb 2011 at 6:07

GoogleCodeExporter commented 9 years ago
I don't work on a Unix environment, so I need some help to fix this.

Original comment by erinca...@gmail.com on 28 Mar 2011 at 6:48

GoogleCodeExporter commented 9 years ago
This link might help, I hope its not outdated:

http://www.cmake.org/pipermail/cmake/2008-September/023808.html

tl;dr
This is what your looking for:

#
# If the user specifies -DCMAKE_BUILD_TYPE on the command line, take their
definition
# and dump it in the cache along with proper documentation, otherwise set
CMAKE_BUILD_TYPE
# to Debug prior to calling PROJECT()
#
IF(DEFINED CMAKE_BUILD_TYPE)
   SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of
build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug
Release RelWithDebInfo MinSizeRel.")
ELSE()
   SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build,
options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release
RelWithDebInfo MinSizeRel.")
ENDIF()

PROJECT(foo)
ADD_EXECUTABLE(foo foo.cc)
#

Original comment by da...@develo.us on 19 Apr 2011 at 9:26

GoogleCodeExporter commented 9 years ago
I _may_ have misused "tl;dr" :P

Original comment by da...@develo.us on 19 Apr 2011 at 9:32

GoogleCodeExporter commented 9 years ago
fwiw here is my experience (fedora14):

A fresh checkout, with no command-line options the build type is release.

Build types can be switched between as mentioned above with "cmake 
-DCMAKE_BUILD_TYPE=xxx", and this gets cached so it's a sticky setting.

I had always thought the default was release, so I'm wondering if the OP had 
not already set his to debug at some point not realizing it was sticky. In any 
case, the second piece of advice above also works, so if you wanted to wanted 
to force the build type one way or the other for a fresh checkout with no 
command line options, you could do that.

Original comment by iforc...@gmail.com on 18 Jun 2011 at 3:05

GoogleCodeExporter commented 9 years ago
The bottom of the that link has a quote that scares me:

"Hope this helps.  Also, be aware it will not work on multiple solution
generators like for Visual Studio."

I'd rather steer clear of lots of platform specific stuff in the cmake files. I 
chose cmake in the first place to get away from platform specific builds.

Original comment by erinca...@gmail.com on 25 Jun 2011 at 11:33