[CMake] FindBoost: FIND_PACKAGE ( Boost COMPONENTS filesystem )

Philip Lowman philip at yhbt.com
Wed Nov 4 11:14:50 EST 2009


Mathieu,

It's a nice idea, but given that Boost could make any one of its libraries
dependent on "system" at any time they want in the future (and for all I
know there are others already dependent on it, besides wave and filesystem),
I'd rather the user be responsible for adding "system" manually.  It's not
too hard to figure this out from the link errors.

On Nov 4, 2009 9:40 AM, "Mathieu Malaterre" <mathieu.malaterre at gmail.com>
wrote:

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 d...
--
Mathieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091104/d5523b41/attachment.htm>


More information about the CMake mailing list