[CMake] Bug in FindBoost or GET_FILENAME_COMPONENT

Cédric Venet cedric.venet at laposte.net
Thu Aug 7 13:19:50 EDT 2008


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)


Another question:
If I use link_directories(${Boost_LIBRARY_DIRS}) and it is in the format
'optimized;path1;debug;path2', does cmake do the right things? What about
other command?

Another thing, shouldn't the case of the Boost/BOOST in the variable be
normalized? I have been bitten with:
# here it is boost without all upper
SET(Boost_USE_STATIC_LIBS ON)
# here it must be all upper
SET(BOOST_ROOT F:/Prog/lib/boostSVN)

Regards,

--
Cédric

Ps: I resend this mail since the first time it hasn't been moderated after
24h



More information about the CMake mailing list