[CMake] Compiling with debug info on OSX

Cristian Bidea cristi at king.com
Thu Sep 19 04:17:10 EDT 2013


If you're using clang or gcc setting the -g compile flag should do the 
trick.

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")

If you're setting the CMAKE_BUILD_TYPE then you should use the 
corresponding configuration flags:

CMAKE_CXX_FLAGS_DEBUG
CMAKE_C_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS_RELEASE

-Cristi

On Wed Sep 18 19:16:26 2013, Alexander Broekhuis wrote:
> I am using the Makefile generator and not XCode.
>
>
> 2013/9/18 Michael Jackson <mike.jackson at bluequartz.net
> <mailto:mike.jackson at bluequartz.net>>
>
>     Are you using Makefiles or the XCode generator or something else?
>     ___________________________________________________________
>     Mike Jackson                    Principal Software Engineer
>     BlueQuartz Software                            Dayton, Ohio
>     mike.jackson at bluequartz.net <mailto:mike.jackson at bluequartz.net>
>     www.bluequartz.net <http://www.bluequartz.net>
>
>     On Sep 18, 2013, at 9:37 AM, Alexander Broekhuis
>     <a.broekhuis at gmail.com <mailto:a.broekhuis at gmail.com>> wrote:
>
>     > Hi all,
>     >
>     > Basically a simple question: How do I compile a library with
>     debug info on OSX?
>     >
>     > I've tried to obvious and set the CMAKE_BUILD_TYPE to Debug. But
>     I am either doing something wrong, or this isn't enough..
>     >
>     > To check if there is debug info I use dwarfdump, and the output
>     always says: .debug_info contents: < EMPTY >
>     >
>     > What am I doing wrong?
>     >
>     > --
>     > Met vriendelijke groet,
>     >
>     > Alexander Broekhuis
>     > --
>     >
>     > Powered by www.kitware.com <http://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://www.cmake.org/mailman/listinfo/cmake
>
>     --
>
>     Powered by www.kitware.com <http://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://www.cmake.org/mailman/listinfo/cmake
>
>
>
>
> --
> Met vriendelijke groet,
>
> Alexander Broekhuis
>
>
> --
>
> 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://www.cmake.org/mailman/listinfo/cmake




More information about the CMake mailing list