[CMake] FindBoost.cmake oddities
Mike Jackson
mike.jackson at bluequartz.net
Thu Dec 11 13:42:38 EST 2008
Andreas Pakulat wrote:
> On 11.12.08 11:38:38, Mike Jackson wrote:
>> Up a bit further I see the culprit:
>>
>> IF ( WIN32 AND Boost_USE_STATIC_LIBS )
>> SET (Boost_LIB_PREFIX "lib")
>> ENDIF ( WIN32 AND Boost_USE_STATIC_LIBS )
>>
>> So I guess I need some logic in my own cmake files that says if Boost
>> was NOT found, set Boost_USE_STATIC_LIBS to TRUE and try again, only if
>> we are on Win32. I am sure I am missing something simple...
>
> The problem is with mixed boost installations, i.e. you have shared and
> static libs. If you have that there's no way to force cmake into finding
> the static version other than changing the suffix variable as cmake will
> always prefer shared over static libraries.
>
> I'm not sure about the lib prefix above, it might be that this is only
> really needed for mingw and not for VS.
>
> Andreas
>
I think it is only needed for msvc. MinGW uses the more unix way (I
think) of naming libraries. libFoo.so?
MSVC does Foo.dll + Foo.lib for dynamic libraries and libFoo.a for
static libraries.
The logic for Mixed installations should be able to be designed.
say we have set (Boost_PREFER_STATIC_LIBS)
now, down in FindBoost.cmake we would need the following table in CMake
code created:
static dyn use_static
static 1 0 0
static 1 0 1
dyn 0 1 0
warning 0 1 1
dyn 1 1 0
static 1 1 1
error 0 0 0
error 0 0 1
Col 1: Which libs get set into the Boost_LIBRARIES variable
Col 2: Were Static Libraries Found
Col 3: Were Dynamic Libraries Found
Col 4: Was use_static set to true
There is going to be some more logic to this to special case the
program_exec_monitor which is ALWAYS static and NEVER dynamic.
Just my thoughts....
Mike.
More information about the CMake
mailing list