[CMake] Why FindBoost messaging not unified?

Mateusz Loskot mateusz at loskot.net
Tue Sep 29 18:04:50 EDT 2009


Hi,

I'm using CMake 2.6-patch2 on Linux (Ubuntu 9.04).

In my opinion FindBoost does not follow somewhat standard
behaviour of other CMake macros (i.e. ZLIB).

In my project I call FIND_PACKAGE this way:

IF(WITH_ZLIB)
   FIND_PACKAGE(ZLIB)
ENDIF()

and here are output variants I get and I expect:

1. Zlib not requested

$ cmake ../source
...
and no verbose message if Zlib was found or not.

2. Zlib requested but missing, so error reported:

$ cmake ../source -DWITH_ZLIB=ON
...
-- Could NOT find ZLIB  (missing:  ZLIB_INCLUDE_DIR)

2. Zlib requested and found, so success reported:

$ cmake ../source -DWITH_ZLIB=ON
...
-- Found ZLIB: /usr/lib/libz.so


I try to follow the same procedure with Boost using FindBoost

IF(WITH_ZLIB)
   FIND_PACKAGE(Boost 1.35)
ENDIF()


1. I have 1.35 version installed and I see message about success:

mloskot at dog:~/proj$ cmake ../main -DWITH_BOOST=ON
...
-- Boost version: 1.35.0
-- Found the following Boost libraries:

2. I have no 1.38 version installed but I ask for Boost 1.38,
so I would expect to see some message, but I get "silence":

mloskot at dog:~/proj$ cmake ../main -DWITH_BOOST=ON
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mloskot/proj

3. The only way to get error is to explicitly use REQUIRED option

FIND_PACKAGE(Boost 1.36 REQUIRED)

but for FIND_PACKAGE(ZLIB) as explained in point 2. above
it is not necessary to explicitly specify REQUIRED option
and error is printed.

I tested the original version of FindBoost from CMake 2.6 as well as
today version from CVS. No difference regarding this issue.

I used ZLIB as example but most of FindXXX macros work this way,

In my opinion behaviours of FindBoost is inconsistent in comparison
to other standard macros.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org


More information about the CMake mailing list