MantisBT - CMake
View Issue Details
0011465CMakeModulespublic2010-11-16 05:562011-06-15 09:03
Jens Mueller 
Philip Lowman 
normalmajoralways
closedno change required 
CMake 2.8.3 
 
0011465: FindBoost does not check the version of the found libraries
I have an old Boost version installed in my system and a newer version local in my home. FindBoost finds the newer version (that's why it passes my required version passed to FindBoost) but uses the libraries in the system which are older than the required version.
It does so because the system libraries are mt but the local version is not mt and Boost_USE_MULTITHREADED defaults to ON.
In any case I think it's a bug to use the older libraries since they do not meet the required version. I suggest to check for version of library if that is possible. If that check cannot be performed a warning should be reported.
I think is bug is quite severe since CMake gives the impression to the user that it made sure the requirements. The user ends up with using a library that she didn't expect.
You need to have at least two boost versions in CMake's search path (version a and version b with a < b). You require version b in your CMakeLists.txt. The libraries of version b need to be found after the ones of version a (are searched later in the search path). Let's say that for version b we installed no libraries at all. Even though the requirements cannot be met FindBoost will use the libraries of version a.
This bug is related to this bug http://public.kitware.com/Bug/bug_view_page.php?bug_id=11019 [^]
No tags attached.
Issue History
2010-11-16 05:56Jens MuellerNew Issue
2010-11-16 10:12Philip LowmanAssigned To => Philip Lowman
2010-11-16 10:12Philip LowmanStatusnew => assigned
2010-11-18 23:01Philip LowmanNote Added: 0023420
2011-06-15 09:03Philip LowmanNote Added: 0026874
2011-06-15 09:03Philip LowmanStatusassigned => closed
2011-06-15 09:03Philip LowmanResolutionopen => no change required

Notes
(0023420)
Philip Lowman   
2010-11-18 23:01   
Jens,

This bug is related to a rather bizarre behavior of find_library() and other functions like find_path() where instead of every possible library name being searched in every possible library path, the reverse happens.

E.g.
find_library(FOO NAMES foo foo2 PATHS /first /second) will search:
/first/libfoo.so
/second/libfoo.so
/first/libfoo2.so
/second/libfoo2.so

Because there are so many possible Boost library name permutations and paths, what ends up happening sometime is that FindBoost picks up the wrong thing.

Until this issue is fixed, the only solution I have at present (introduced in CMake 2.8.3) is setting the variable Boost_NO_SYSTEM_PATHS This effectively prevents finding Boost libraries outside of the discovered Boost include directory (unless the user has set BOOST_ROOT or BOOST_LIBRARYDIR, or one of the CMake variables like CMAKE_PREFIX_PATH, then those paths are also considered).

P.S.
I don't think searching the libraries for version information would be technically practical to do because of speed (even if each library had a symbol with the version number of Boost, which is doubtful).
(0026874)
Philip Lowman   
2011-06-15 09:03   
Can't remove version check from filename as it could break people.
Suggested workaround is to use Boost_NO_SYSTEM_PATHS & BOOST_ROOT.