Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] CMAKE_CXX_FLAGS on Darwin...
From: R. Douglas Barbieri (dooglio_at_[hidden])
Date: 2009-10-29 21:53:13


Adding the ${CMAKE_CXX_FLAGS} to ADD_DEFINITIONS() seems redundant.to
me because CMAKE_CXX_FLAGS already sets definitions passed to the c++
compiler. I think this flag is more useful for setting
config-dependent flags, e.g. CMAKE_CXX_FLAGS_DEBUG and
CMAKE_CXX_FLAGS_RELEASE, but maybe others on the list can correct me
if I'm wrong.

As I understand it, you should just be able to use ADD_DEFINITIONS(
-gdwarf2 ) and then later ADD_DEFINITIONS( -Wno-deprecated ) later in
the code snippet. If you want to use CMAKE_CXX_FLAGS instead, just set
it like so: SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gdwarf2 ).

On Thu, Oct 29, 2009 at 3:37 PM, Sean Chittenden <sean_at_[hidden]> wrote:
> I've been running with the following snippet in my boost build directory for
> a while.
>
>> IF(CMAKE_COMPILER_IS_GNUCXX)
>>  IF(APPLE)
>>    ADD_DEFINITIONS(${CMAKE_CXX_FLAGS} "-gdwarf-2")
>>  ENDIF(APPLE)
>>
>>  # At some point in the future, this won't be requied to silence an
>>  # error message for boost, but for the time being it is.
>>  ADD_DEFINITIONS(${CMAKE_CXX_FLAGS} "-Wno-deprecated")
>> ENDIF(CMAKE_COMPILER_IS_GNUCXX)
>>
>
> If boost isn't built for the current project, I have cmake call a shell
> scipt to use cmake to build boost (passed in via
> -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}).  The -gdwarf-2 flag prevents N_GSYM
> errors on Darwin, similar to the following:
>
> cd
> /Users/sean/src/obj/contrib-Darwin-i386/boost-1.40.0.cmake2.obj/libs/thread/src
> && /opt/local/bin/cmake -E cmake_link_script
> CMakeFiles/boost_thread-mt-shared-debug.dir/link.txt --verbose=1
> /opt/local/bin/g++-mp-4.3   -dynamiclib -headerpad_max_install_names
>  -o ../../../lib/libboost_thread-mt-d.dylib -install_name
> /Users/sean/src/obj/contrib-Darwin-i386/boost-1.40.0.cmake2.obj/lib/libboost_thread-mt-d.dylib
> CMakeFiles/boost_thread-mt-shared-debug.dir/pthread/thread.cpp.o
> CMakeFiles/boost_thread-mt-shared-debug.dir/pthread/exceptions.cpp.o
> CMakeFiles/boost_thread-mt-shared-debug.dir/pthread/once.cpp.o ld: warning:
> can't find atom for N_GSYM stabs uninitialized_flag:G(0,1440) in
> CMakeFiles/boost_thread-mt-shared-debug.dir/pthread/thread.cpp.old: warning:
> can't find atom for N_GSYM stabs being_initialized:G(0,1440) in
> CMakeFiles/boost_thread-mt-shared-debug.dir/pthread/thread.cpp.o
> /opt/local/bin/cmake -E cmake_progress_report
> /Users/sean/src/obj/contrib-Darwin-i386/boost-1.40.0.cmake2.obj/CMakeFiles
>  6
>
> Starting with cmake2, it looks like CMAKE_CXX_FLAGS is being reset somewhere
> along the lines.  Is there a correct/better way to pass this in to CMake or
> is there a way to have Boost cmake automatically set -gdwarf-2 using the
> above logic?  tia.  -sc
>
>
> --
> Sean Chittenden
> sean_at_[hidden]
>
>
>
> _______________________________________________
> Boost-cmake mailing list
> Boost-cmake_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-cmake
>

-- 
Doug Barbieri
dooglio_at_[hidden]

Boost-cmake list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk