[CMake] Setting build type

Adam Getchell adam.getchell at gmail.com
Fri Feb 27 11:46:14 EST 2015


Thanks for the help!

It still runs Release mode:

Here's my project:

https://github.com/acgetchell/CDT-plusplus

┌─[*adam*][Hapkido][*±*][master *✗*][~/CDT-plusplus]

└─▪ tree

.

|____.git

| |____config

| |____description

| |____HEAD

| |____hooks

| | |____applypatch-msg.sample

| | |____commit-msg.sample

| | |____post-update.sample

| | |____pre-applypatch.sample

| | |____pre-commit.sample

| | |____pre-push.sample

| | |____pre-rebase.sample

| | |____prepare-commit-msg.sample

| | |____update.sample

| |____index

| |____info

| | |____exclude

| |____logs

| | |____HEAD

| | |____refs

| | | |____heads

| | | | |____master

| | | |____remotes

| | | | |____origin

| | | | | |____HEAD

| |____objects

| | |____info

| | |____pack

| | | |____pack-a9db5eb5c90025a8ca13bddf15822cb0e57cbead.idx

| | | |____pack-a9db5eb5c90025a8ca13bddf15822cb0e57cbead.pack

| |____packed-refs

| |____refs

| | |____heads

| | | |____master

| | |____remotes

| | | |____origin

| | | | |____HEAD

| | |____tags

|____.gitignore

|____.travis-linux.yml

|____.travis-macosx.yml

|____.travis.yml

|____build.sh

|____CMakeLists.txt

|____Doxyfile

|____LICENSE

|____README.md

|____scan-build.sh

|____src

| |____cdt.cpp

| |____Delaunay.h

| |____docopt

| | |____docopt.cpp

| | |____docopt.h

| | |____docopt_private.h

| | |____docopt_util.h

| | |____docopt_value.h

| | |____examples

| | | |____naval_fate.cpp

| | |____LICENSE-Boost-1.0

| | |____LICENSE-MIT

| | |____main.cpp

| | |____README.rst

| | |____run_testcase.cpp

| | |____run_tests.py

| | |____testcases.docopt

| |____grid_d.cpp

| |____grid_d.h

| |____periodic_3_complex.h

| |____periodic_3_triangulations.h

| |____Point.h

| |____S3Action.h

| |____S3ErgodicMoves.h

| |____S3Triangulation.h

| |____sphere_d.h

| |____utilities.h

|____unittests

| |____.gitignore

| |____main.cpp

| |____PointTest.cpp

| |____S3BulkActionTest.cpp

| |____S3ErgodicMovesTest.cpp

| |____S3TetrahedronTest.cpp

| |____SdTriangulationTest.cpp

| |____SphereTest.cpp

| |____Triangulated2SphereTest.cpp

| |____VertexTest.cpp

┌─[*adam*][Hapkido][*±*][master *✗*][~/CDT-plusplus]

└─▪ mkdir build-d

┌─[*adam*][Hapkido][*±*][master *✗*][~/CDT-plusplus]

└─▪ cd build-d

┌─[*adam*][Hapkido][*±*][master *✗*][~/CDT-plusplus/build-d]

└─▪ cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=out ..

-- The C compiler identification is AppleClang 6.0.0.6000056

-- The CXX compiler identification is AppleClang 6.0.0.6000056

-- Check for working C compiler: /usr/bin/cc

-- Check for working C compiler: /usr/bin/cc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working CXX compiler: /usr/bin/c++

-- Check for working CXX compiler: /usr/bin/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Build type: Release

-- USING CXXFLAGS = ' -O3 -DNDEBUG'

-- USING EXEFLAGS = '
-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
'

-- Targetting Unix Makefiles

-- Using /usr/bin/c++ compiler.

-- DARWIN_VERSION=14

-- Mac Leopard detected

-- Requested component: Core

-- Requested component: MPFR

-- Requested component: GMP

-- Found Eigen3: /usr/local/include/eigen3 (found suitable version "3.2.4",
minimum required is "3.1.0")

-- Found Intel TBB

-- Configuring done

-- Generating done

-- Build files have been written to: /Users/adam/CDT-plusplus/build-d

┌─[*adam*][Hapkido][*±*][master *✗*][~/CDT-plusplus/build-d]


On Wed, Feb 25, 2015 at 1:37 AM, J Decker <d3ck0r at gmail.com> wrote:

> mkdir build-d
> cd build-d
> cmake
> -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=out ../your/source/procject
> cmake --build .
> cd ..
>
> mkdir build-r
> cd build-r
> cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out
> ../your/source/procject
> cmake --build . --target install
> cd ..
>
>
> On Wed, Feb 25, 2015 at 1:16 AM, Adam Getchell <adam.getchell at gmail.com>
> wrote:
>
>> Thanks for your reply.
>>
>> I'm not sure I follow your answer. I do delete the directory each time I
>> build, but I'm still not understanding how you're building release or debug
>> versions to begin with.
>>
>> I'm just automatically getting Release, unless I edit CMakeCache.txt
>> after I've built once.
>>
>> I just checked CGAL_CreateSingleSourceCGALProgram.cmake which is invoked
>> in my CMakeLists.txt, but I do not see it setting the build type to Release.
>>
>> https://github.com/acgetchell/CDT-plusplus/blob/master/CMakeLists.txt
>>
>>
>>
>> On Tue, Feb 24, 2015 at 12:20 PM, J Decker <d3ck0r at gmail.com> wrote:
>>
>>> I use a different directory to build release and debug versions....
>>>
>>> if you didn't delete, then when it goes to build partial things, the
>>> .obj files will still be newer than the .c files and will cause mixed
>>> release-debug builds which generally results in bizarre crashes.
>>> Once chosen, can't change the build type of a build; although if you
>>> could it should do a clean also.
>>>
>>>
>>> On Tue, Feb 24, 2015 at 11:42 AM, Adam Getchell <adam.getchell at gmail.com
>>> > wrote:
>>>
>>>> Hello all,
>>>>
>>>> I've browsed this thread:
>>>>
>>>> http://www.cmake.org/pipermail/cmake/2008-September/023808.html
>>>>
>>>> But it doesn't work. My project is set to Release regardless, whether I
>>>> do:
>>>>
>>>> project( CDT-plusplus_ )
>>>> set(CMAKE_BUILD_TYPE RelWithDebInfo)
>>>>
>>>> Or:
>>>>
>>>> #
>>>> # 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( CDT-plusplus_ )
>>>>
>>>> The only way I can change the build type is by going into my build
>>>> directory and editing CMakeCache.txt. However, I use an out of source
>>>> build, so my build directory is generated automatically by scripts such as:
>>>>
>>>> https://github.com/acgetchell/CDT-plusplus/blob/master/scan-build.sh
>>>>
>>>> What's the correct method for being able to set the type of build via
>>>> the command line?
>>>>
>>>> --
>>>> Adam Getchell
>>>> about.me/adamgetchell
>>>> "Invincibility is in oneself, vulnerability in the opponent." -- Sun Tzu
>>>>
>>>> --
>>>>
>>>> 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
>>>>
>>>
>>>
>>
>>
>> --
>> Adam Getchell
>> about.me/adamgetchell
>> "Invincibility is in oneself, vulnerability in the opponent." -- Sun Tzu
>>
>
>


-- 
Adam Getchell
about.me/adamgetchell
"Invincibility is in oneself, vulnerability in the opponent." -- Sun Tzu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150227/c19c5501/attachment-0001.html>


More information about the CMake mailing list