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
s...@chittenden.org



_______________________________________________
Boost-cmake mailing list
Boost-cmake@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-cmake

Reply via email to