Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] Building boost "with an uninstalled build" and linking to boost libs
From: Brian Davis (bitminer_at_[hidden])
Date: 2010-03-29 17:52:57


In BoostConfig.cmake I had to comment out the following (from a previous
post on the CMake users mailing list):

# Clear out the built-in C++ compiler and link flags for each of the
# configurations.
#~ set(CMAKE_CXX_FLAGS_DEBUG "" CACHE INTERNAL "Unused by Boost")
#~ set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "" CACHE INTERNAL "Unused by Boost")
#~ set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "" CACHE INTERNAL "Unused by Boost")
#~ set(CMAKE_EXE_LINKER_FLAGS_DEBUG "" CACHE INTERNAL "Unused by Boost")
#~ set(CMAKE_CXX_FLAGS_RELEASE "" CACHE INTERNAL "Unused by Boost")
#~ set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "" CACHE INTERNAL "Unused by
Boost")
#~ set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "" CACHE INTERNAL "Unused by
Boost")
#~ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "" CACHE INTERNAL "Unused by Boost")
#~ set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused by Boost")
#~ set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused by
Boost")
#~ set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused by
Boost")
#~ set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused by
Boost")
#~ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused by Boost")
#~ set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused by
Boost")
#~ set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused by
Boost")
#~ set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused by
Boost")

Due to the use of CACHE INTERNAL when using add_subdirectory. As I recall
this precluded me from being able to set These variables in my calling
CMakeLists.txt file. This resulted in getting the error:

1>Compiling...
1>cl : Command line error D8016 : '/O2' and '/RTC1' command-line options are
incompatible
1>Build log was saved at
"file://c:\projects\NIH2009\source\branches\trunk\build\dvip4-Win64\libs\filesystem\src\boost_filesystem-mt-static-staticrt.dir\Debug\

This is seemingly caused by:

  SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
  SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")

boost configuration CMake and in Windows-cl.cmake in
cmake-2.8/Modules/Platform/Windows-cl-cmake. If I comment out the lines
above including RTC1 in Windows-cl.cmake boost_filesystem builds when using
add_subdirectory the build is successful.

If I perform CACHE STRING "" FORCE on the following variables and
boost_filesystem then builds. Note the removal of /RTC1.

    SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od" CACHE
STRING "" FORCE )
    SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od" CACHE STRING
"" FORCE )
    SET( CMAKE_CXX_FLAGS_DEBUG /D_DEBUG /MDd /Zi /Ob0 /Od CACHE STRING ""
FORCE )
    SET( CMAKE_C_FLAGS_DEBUG /D_DEBUG /MDd /Zi /Ob0 /Od CACHE STRING ""
FORCE )

Not sure if I should be doing this. It works so I am going to go stick my
head in the sand until something else breaks.

Brian



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