I wasn't aware of this defect.  Thanks for pointing it out.

Could you give the attached version a whirl?  I got rid of the odd caching
behavior (not sure exactly why FindBoost was written that way to begin
with) and this appears to resolve the bug.

On Tue, Jun 19, 2012 at 10:54 AM, Andriy Gapon <a...@icyb.net.ua> wrote:

>
> FindBoost.cmake currently (as of CMake 2.8.8) has fairly simply logic to
> see if
> Boost is already found and the relevant variables are cached.
> Essentially that logic verifies that Boost_INCLUDE_DIR and
> Boost_${COMPONENT}_FOUND variables are set.
>
> What it doesn't do is validate that the found/cached Boost version
> satisfies the
> requested version.  At least it seems so.  And this is amplified by the
> fact that
> the variables remained set and cached even if the original search for Boost
> couldn't find a satisfactory version.
>
> A sample CMakeLists.txt file:
>
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
> PROJECT(boost_test)
> FIND_PACKAGE(Boost 1.51)
> IF(Boost_FOUND)
>        MESSAGE("Boost 1.51 found!!!")
> ELSE(Boost_FOUND)
>        MESSAGE("Boost 1.51 not found...")
> ENDIF(Boost_FOUND)
>
>
> As you know, Boost 1.51 doesn't exist yet.
>
> But on a system with Boost 1.48.0 installed I get:
>
> $ cmake .
> -- The C compiler identification is GNU 4.2.1
> -- The CXX compiler identification is GNU 4.2.1
> -- 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
> -- Could NOT find Boost
> Boost 1.51 not found...
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/avg/tmp/boost-test
>
> So far so good.  Running cmake again:
>
> $ cmake .
> Boost 1.51 found!!!
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/avg/tmp/boost-test
>
> Adding SET(Boost_DEBUG TRUE) I get the following for a secondary run:
> $ cmake .
> -- [ /usr/local/share/cmake/Modules/FindBoost.cmake:519 ] boost 1.48.0 is
> already
> in the cache.  To view debugging messages, please clear the cache.
> Boost 1.51 found!!!
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/avg/tmp/boost-test
>
> So FindBoost correctly knows that it has seen boost 1.48.0, but it
> misreports that
> boost 1.51 is available.
>
> --
> Andriy Gapon
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>



-- 
Philip Lowman

Attachment: FindBoost.cmake.gz
Description: GNU Zip compressed data

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to