[CMake] FindBoost.cmake updated on the bugtracker

Doug Gregor doug.gregor at gmail.com
Tue Apr 8 16:43:30 EDT 2008


On Tue, Apr 8, 2008 at 5:54 AM, Andreas Pakulat <apaku at gmx.de> wrote:
>  New version uploaded.

I've looked through this module a bit, and it looks like it's in great
shape. I have a few suggestions, implemented in the attached
FindBoost.cmake; the diff against "v9" from the bug tracker follows.
The changes I made where:

  - Fixed setting of Boost_LIBRARIES when the QUIET option is passed
to FIND_PACKAGE
  - Made non-user-configurable cache entries INTERNAL; mark other
options advanced
  - Minor formatting changes for some of the output.

I don't have a Windows machine easily available, so I'd like to take
it for a spin on Windows as well.

  - Doug

--- /u/dgregor/Downloads/FindBoost_v9.cmake.txt 2008-04-08 05:49:48.000000000 -0
400
+++ FindBoost.cmake     2008-04-08 16:37:34.000000000 -0400
@@ -9,7 +9,7 @@
 # boost version numbers that should be taken into account when searching
 # for the libraries. Unfortunately boost puts the version number into the
 # actual filename for the libraries, so this might be needed in the future
-# when new boost versions are released.
+# when new Boost versions are released.
 #
 # Currently this module searches for the following version numbers:
 # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0
@@ -145,7 +145,7 @@
     IF (Boost_${basename}_LIBRARY)
       SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH
 "The Boost ${basename} library")
       GET_FILENAME_COMPONENT(Boost_LIBRARY_DIRS "${Boost_${basename}_LIBRARY}"
PATH)
-      SET(Boost_${basename}_FOUND ON CACHE BOOL "Was the boost boost ${basename
} library found")
+      SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Was the boost boost ${base
name} library found")
     ENDIF (Boost_${basename}_LIBRARY)

   ENDIF (Boost_INCLUDE_DIR )
@@ -311,8 +311,8 @@
     STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSI
ON "${_boost_VERSION_HPP_CONTENTS}")
     STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Bo
ost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")

-    SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE STRING "The library versio
n string for boost libraries")
-    SET(Boost_VERSION ${Boost_VERSION} CACHE STRING "The version number for boo
st libraries")
+    SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library vers
ion string for boost libraries")
+    SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for b
oost libraries")

     IF(NOT "${Boost_VERSION}" STREQUAL "0")
       MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
@@ -512,19 +512,23 @@

   IF (Boost_FOUND)
       IF (NOT Boost_FIND_QUIETLY)
-        MESSAGE(STATUS "Found The Following Boost Libraries:")
-        FOREACH ( COMPONENT  ${Boost_FIND_COMPONENTS} )
-          STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT )
-          IF ( Boost_${UPPERCOMPONENT}_FOUND )
-            MESSAGE (STATUS "  ${COMPONENT}")
-           SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIB
RARY})
-          ENDIF ( Boost_${UPPERCOMPONENT}_FOUND )
-        ENDFOREACH(COMPONENT)
-       MESSAGE(STATUS "Boost Version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERS
ION}.${Boost_SUBMINOR_VERSION}")
+       MESSAGE(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERS
ION}.${Boost_SUBMINOR_VERSION}")
+      ENDIF(NOT Boost_FIND_QUIETLY)
+      IF (NOT Boost_FIND_QUIETLY)
+        MESSAGE(STATUS "Found the following Boost libraries:")
       ENDIF(NOT Boost_FIND_QUIETLY)
+      FOREACH ( COMPONENT  ${Boost_FIND_COMPONENTS} )
+        STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT )
+        IF ( Boost_${UPPERCOMPONENT}_FOUND )
+          IF (NOT Boost_FIND_QUIETLY)
+            MESSAGE (STATUS "  ${COMPONENT}")
+          ENDIF(NOT Boost_FIND_QUIETLY)
+         SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRA
RY})
+        ENDIF ( Boost_${UPPERCOMPONENT}_FOUND )
+      ENDFOREACH(COMPONENT)
   ELSE (Boost_FOUND)
       IF (Boost_FIND_REQUIRED)
-        MESSAGE(STATUS "Boost Version required: ${Boost_FIND_VERSION}. Found: $
{Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
+        MESSAGE(STATUS "Boost version required: ${Boost_FIND_VERSION}. Found: $
{Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
         MESSAGE(FATAL_ERROR "Couldn't find the Boost libraries and/or include i
rectory, or the version found is too old. Please install the Boost libraries AND
 development packages. You can set BOOST_ROOT, BOOST_INCLUDEDIR and BOOST_LIBRAR
YDIR to help find Boost.")
       ENDIF(Boost_FIND_REQUIRED)
   ENDIF(Boost_FOUND)
@@ -535,9 +539,10 @@
   ENDIF(WIN32)

   # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advan
ced view
-  MARK_AS_ADVANCED(Boost_INCLUDE_DIRS
-      Boost_LIBRARIES
+  MARK_AS_ADVANCED(Boost_INCLUDE_DIR
+      Boost_INCLUDE_DIRS
       Boost_LIBRARY_DIRS
+      Boost_USE_MULTITHREADED
   )
 ENDIF(_boost_IN_CACHE)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FindBoost.cmake
Type: application/octet-stream
Size: 26314 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080408/70566bdc/attachment-0001.obj>


More information about the CMake mailing list