[CMake] FindBoost: FIND_PACKAGE ( Boost COMPONENTS filesystem )

Mathieu Malaterre mathieu.malaterre at gmail.com
Wed Nov 4 09:39:49 EST 2009


Philip,

  I guess I was not very clear in my previous email. But here is my
proposed change:

@@ -322,8 +322,14 @@
   if(Boost_VERSION AND Boost_FIND_COMPONENTS)
      math(EXPR _boost_maj "${Boost_VERSION} / 100000")
      math(EXPR _boost_min "${Boost_VERSION} / 100 % 1000")
-     if(${_boost_maj}.${_boost_min} VERSION_LESS 1.35)
-       list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
+     if(${_boost_maj}.${_boost_min} VERSION_GREATER 1.34)
+       # when use asked for filesystem or wave, automatically add
+       # system to the list of components
+       list(FIND Boost_FIND_COMPONENTS filesystem v1)
+       list(FIND Boost_FIND_COMPONENTS wave v2)
+       if(v1 OR v2)
+         list(APPEND Boost_FIND_COMPONENTS system)
+       endif(v1 OR v2)
      endif()
   endif()


Therefore calling

FIND_PACKAGE ( Boost COMPONENTS filesystem REQUIRED)

will work on boost 1.34 and boost > 1.34

Comments ?

On Tue, Nov 3, 2009 at 3:20 PM, Mathieu Malaterre
<mathieu.malaterre at gmail.com> wrote:
> The way I see it to address is that 'system' is an internal details
> (AFAIK). It should be automatically pulled in for filesystem and wave
> (for boost > 1.34), instead of the contrary (removing system when
> using boost 1.34).
> So this means I will be breaking the interface...
>
> Comments anyone ?
>
> On Tue, Nov 3, 2009 at 3:14 PM, Philip Lowman <philip at yhbt.com> wrote:
>> This was addressed on the mailing list and I thought had been resolved based
>> on user feedback.
>>
>> The code which is supposed to fix this is on line 326 of FindBoost as
>> checked into CVS.  A patch would be appreciated if the code doesn't work for
>> you.
>>
>> See also bug 8734
>>
>> On Nov 3, 2009 5:05 AM, "Mathieu Malaterre" <mathieu.malaterre at gmail.com>
>> wrote:
>>
>> Hi Philip,
>>
>>  That's where I stop understanding. I cannot state this:
>>
>> FIND_PACKAGE ( Boost COMPONENTS filesystem REQUIRED) # ideal
>>
>>  If I follow your suggestion I need to express an internal
>> dependencie at user level:
>>
>> FIND_PACKAGE ( Boost COMPONENTS filesystem system REQUIRED)
>>
>>  which fails for Boost 1.34 with:
>>
>> ...
>> CMake Error at Cmake/FindBoost.cmake:894 (message):
>>  Unable to find the requested Boost libraries.
>>
>>  Boost version: 1.34.1
>>
>>  Boost include path: /usr/include
>>
>>  The following Boost libraries could not be found:
>>
>>          boost_system
>>
>>  Some (but not all) of the required Boost libraries were found.  You may
>>  need to install these additional Boost libraries.  Alternatively, set
>>  Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
>>  to the location of Boost.
>> Call Stack (most recent call first):
>>  CMakeLists.txt:33 (FIND_PACKAGE)
>> ...
>>
>> Thanks
>>
>> On Mon, Nov 2, 2009 at 6:24 PM, Philip Lowman <philip at yhbt.com> wrote: > Add
>> system to the list of ...
>>
>> --
>> Mathieu
>>
>
>
>
> --
> Mathieu
>



-- 
Mathieu


More information about the CMake mailing list