Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] Another small issue with Boost.CMake and FindBoost.cmake
From: Michael Jackson (mike.jackson_at_[hidden])
Date: 2009-12-16 14:41:57


On 12/16/09 2:11 PM, in article 87fx7a3fa0.fsf_at_[hidden], "Troy D.
Straszheim" wrote:

> Michael Jackson <mike.jackson_at_[hidden]> writes:
>
>> On 12/16/09 1:41 PM, in article
>> 2A66CBE0-57C7-45D4-8D44-CDDC6B93557F_at_[hidden],
>> "Michael Jackson"
>> wrote:
>>
>>> Trying things out on windows and I noticed that when I build static
>>> libraries that the names of the libraries are NOT prefixed with "lib"
>>> like in the bjam version of the build. This causes the FindBoost
>>> included with CMake 2.6.4 and 2.8.0 to NOT find an installed boost on
>>> Windows using Visual Studio.
>>>
>>> Where would this sort of thing be set in the CMake files?
>>>
>>> _________________________________________________________
>>> Mike Jackson
>>
>> On line 705 of BoostCore.cmake is the line that sets the library prefix
>> using the LIBPREFIX variable. From what I can tell this cmake variable is
>> Not set anywhere else in the build system (at least that I can find). Adding
>> a Cmake cache entry for LIBPREFIX:STRING=lib on windows for static builds
>> allowed the proper naming. Not sure if this is by design or got left out by
>> accident.
>>
>> Maybe we need a "bjam" compatible mode to set all these types of things for
>> the next few releases of boost and Cmake. At least until Cmake as it is
>> distributed can handle the new paths in the boost installation.
>>
>
> I'm almost certain this is simple oversight. I'm reliant on windows
> guys for testing. You may just be the first to look carefully at this.
>
> -t

In the FindBoost.cmake file there is a line like:

  # Setting some more suffixes for the library
  SET (Boost_LIB_PREFIX "")
  if ( WIN32 AND Boost_USE_STATIC_LIBS )
    SET (Boost_LIB_PREFIX "lib")
  endif()

Which means the Boost.Cmake project really needs to mimic this, which it
tried to do, but just missed like you said, probably just over looked it.

In that same BoostCore.cmake file there is:

if (THIS_LIB_IS_STATIC)
add_library(${VARIANT_LIBNAME} STATIC ${THIS_LIB_SOURCES})
# On Windows, we need static and shared libraries to have
# different names, so we follow the Boost.Build version 2 style
# and prepend "lib" to the name.
if(WIN32 AND NOT (CYGWIN OR MINGW))
     set_target_properties(${VARIANT_LIBNAME}
       PROPERTIES
       PREFIX "${LIBPREFIX}" <===== Probably just change this?
     )
endif()
.....
Change that to:

     set_target_properties(${VARIANT_LIBNAME}
       PROPERTIES
       PREFIX "lib"
     )

Thoughts?
Mike Jackson


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