[CMake] Bug in FindBoost or GET_FILENAME_COMPONENT

Andreas Pakulat apaku at gmx.de
Thu Aug 7 13:43:18 EDT 2008


On 07.08.08 19:19:50, Cédric Venet wrote:
> Hi,
> 
> I (think that I) found a bug but since I am just starting to use cmake, I
> don't know how to fix it correctly.
> 
> If I use FindBoost, cmake 2.6.1 generate:
> 
> Boost_LIBRARY_DIRS=
> optimized;F:/Prog/lib/boostSVN/stage/lib/libboost_thread-vc80-mt-1_35.lib;de
> bug;F:/Prog/lib/boostSVN/stage/lib/
> 
> Because
> 
> GET_FILENAME_COMPONENT was called with
> Boost_THREAD_LIBRARY=optimized;F:/Prog/lib/boostSVN/stage/lib/libboost_threa
> d-vc80-mt-1_35.lib;debug;F:/Prog/lib/boostSVN/stage/lib/libboost_thread-vc80
> -mt-gd-1_35.lib 
> 
> And it seems it only get the path on the last file of the list. I see three
> possible problems/fixes:
> - the format 'optimized;path1;debug;path2' isn't good
> - the GET_FILENAME_COMPONENT should handle correctly this case
> - the findboost should call GET_FILENAME_COMPONENT on each part of the list.
> 
> As a quick fix I just changed (around line 160 of FindBoost.cmake)
>       GET_FILENAME_COMPONENT(Boost_LIBRARY_DIRS
> "${Boost_${basename}_LIBRARY}" PATH) in
>       GET_FILENAME_COMPONENT(Boost_LIBRARY_DIRS
> "${Boost_${basename}_LIBRARY_RELEASE}" PATH)

Uhm, Boost_LIBRARY_DIRS should _never_ have actual libraries in it. So
indeed the bug is that GET_FILENAME_COMPONENT should be used with either
(_RELEASE or _DEBUG) or _LIBRARY depending on which one is set. i.e. if
_RELEASE is set use that, if not check _DEBUG, if not use _LIBRARY.

Andreas

-- 
You will be reincarnated as a toad; and you will be much happier.


More information about the CMake mailing list