[CMake] findBoost says it finds static unit testing libraries, but does not set them

Philip Lowman philip at yhbt.com
Sun Apr 19 14:16:23 EDT 2009


On Sat, Apr 18, 2009 at 4:23 PM, Andreas Pakulat <apaku at gmx.de> wrote:

> On 18.04.09 11:24:48, Philip Lowman wrote:
> > On Sat, Apr 18, 2009 at 7:45 AM, Michael Jackson <
> > mike.jackson at bluequartz.net> wrote:
> > > On Apr 17, 2009, at 11:56 PM, Philip Lowman wrote:
> > >  On Thu, Apr 16, 2009 at 4:27 AM, Jonatan Bijl <jonatan.bijl at tba.nl>
> > >> wrote:
> > >> Boost_Unit_test_framework_library is not in the list.
> > >>
> > >> About the filenames: these libs are the result of compiling boost
> 1.38.0
> > >> with cmake under linux. (Cmake for boost is still experimental). It
> might be
> > >> that the problem is in boost’s Cmakelists.
> > >>
> > >> That is definitely a bug that needs to be fixed in Boost's
> experimental
> > >> CMake build.
> > >>
> > >> If you rename the library to "libboost_unit_test_framework-mt-sd.a",
> > >> however, it's still not going to solve your problem.
> > >>
> > >> The 's' tag is for static C++ runtime libraries and for some reason
> it's
> > >> enabled on Windows in FindBoost.cmake when you set
> Boost_USE_STATIC_LIBS,
> > >> but not on other platforms.  This has always seemed a bit weird to me
> and
> > >> I've wondered why this is.
> > >>
> > >> SET( _boost_STATIC_TAG "")
> > >>  set( _boost_ABI_TAG "")
> > >>  IF (WIN32)
> > >>    IF(MSVC)
> > >>      SET (_boost_ABI_TAG "g")
> > >>    ENDIF(MSVC)
> > >>    IF( Boost_USE_STATIC_LIBS )
> > >>      SET( _boost_STATIC_TAG "-s")
> > >>
> > >>    ENDIF( Boost_USE_STATIC_LIBS )
> > >>  ENDIF(WIN32)
> > >>  SET (_boost_ABI_TAG "${_boost_ABI_TAG}d")
> > >>  if(Boost_DEBUG)
> > >>    message(STATUS "[
> ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}
> > >> ] "
> > >>
> > >>      "_boost_STATIC_TAG = ${_boost_STATIC_TAG}")
> > >>    message(STATUS "[
> ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}
> > >> ] "
> > >>      "_boost_ABI_TAG = ${_boost_ABI_TAG}")
> > >>  endif()
> > >> --
> > >> Philip Lowman
> > >>
> > >>
> > > It is enabled on windows because Windows offers the option to
> statically
> > > linkCMake 2.6.3's to the c++ runtime. I know OS X does NOT offer that
> > > option. Not sure about linux.
> >
> > The same variable name controls whether or not you're searching for a
> static
> > or a shared boost library, however.
>
> Right, the reason why it only adds the "s" flag on win32 is because boost
> libs only have that flag on win32 for their static libraries. The reason is
> that on linux the static boost libs still link against the shared c
> runtime, while on windows they link against the static c runtime. So the
> variable controls wether to link against a shared or a static boost lib,
> which means lib<component>-<compiler>-<threading>-<version>.a on linux and
> similar on windows, except that here the "s" flag is needed.
>
> All this based on a normal boost installation from source, not using the
> experimental cmake buildsystem. If that one does it differently thats a bug
> in the cmake buildsystem for boost.


I just used bjam and it happily built static libraries for win32 without the
"s" flag on them.

libboost_filesystem-vc90-mt-1_38.lib
libboost_filesystem-vc90-s-1_38.lib
libboost_filesystem-vc90-mt-s-1_38.lib

So I guess the question is how to fix FindBoost to do the right thing
without breaking anyone's builds.

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090419/fb214678/attachment.htm>


More information about the CMake mailing list