MantisBT - CMake
View Issue Details
0006257CMakeModulespublic2008-01-17 15:102008-07-03 16:02
Andreas Pakulat 
Bill Hoffman 
normalmajoralways
closedfixed 
 
CMake-2-6 
0006257: Improvements to FindBoost.cmake
Based on the FindBoost.cmake from Andreas Schneider and with some tweaks from Mike Jackson I have produce a FindBoost.cmake which not only sets include and library dir, but also provides variables for the actual libraries of boost. This way its easier to write portable cmake files that link to boost, as the logic to handle different platforms/compilers/debug/release versions is directly in the FindBoost.cmake.

The module is currently used by KDevPlatform a KDE project and is going to be tested (in the upcoming weeks/months) thoroughly on a variant of Linux systems, MacOSX, Windows and probably also some Unices.
No tags attached.
? FindBoost.cmake (12,645) 2008-01-17 15:10
https://public.kitware.com/Bug/file/1287/FindBoost.cmake
? FindBoost_v2.cmake (20,366) 2008-02-15 12:13
https://public.kitware.com/Bug/file/1313/FindBoost_v2.cmake
? FindBoost_v3.cmake (21,368) 2008-03-27 18:31
https://public.kitware.com/Bug/file/1371/FindBoost_v3.cmake
? FindBoost_v4.cmake (22,275) 2008-04-05 13:16
https://public.kitware.com/Bug/file/1388/FindBoost_v4.cmake
? FindBoost_v5.cmake (23,803) 2008-04-05 17:59
https://public.kitware.com/Bug/file/1389/FindBoost_v5.cmake
? FindBoost_v6.cmake (25,188) 2008-04-05 18:09
https://public.kitware.com/Bug/file/1390/FindBoost_v6.cmake
? FindBoost_v7.cmake (25,227) 2008-04-05 18:11
https://public.kitware.com/Bug/file/1391/FindBoost_v7.cmake
? FindBoost_v8.cmake (26,038) 2008-04-07 19:18
https://public.kitware.com/Bug/file/1399/FindBoost_v8.cmake
? FindBoost_v9.cmake (26,139) 2008-04-08 05:49
https://public.kitware.com/Bug/file/1400/FindBoost_v9.cmake
Issue History
2008-01-17 15:10Andreas PakulatNew Issue
2008-01-17 15:10Andreas PakulatFile Added: FindBoost.cmake
2008-01-19 18:13Andreas PakulatNote Added: 0010201
2008-02-15 10:42Bill HoffmanStatusnew => assigned
2008-02-15 10:42Bill HoffmanAssigned To => Alex Neundorf
2008-02-15 12:11Andreas PakulatNote Added: 0010517
2008-02-15 12:12Alex NeundorfNote Added: 0010518
2008-02-15 12:12Alex NeundorfAssigned ToAlex Neundorf => Bill Hoffman
2008-02-15 12:12Alex NeundorfCategoryCMake => Modules
2008-02-15 12:13Andreas PakulatFile Added: FindBoost_v2.cmake
2008-02-15 12:17Andreas PakulatNote Added: 0010519
2008-03-27 18:31Andreas PakulatFile Added: FindBoost_v3.cmake
2008-03-27 18:32Andreas PakulatNote Added: 0010936
2008-04-05 13:16Andreas PakulatNote Added: 0011073
2008-04-05 13:16Andreas PakulatFile Added: FindBoost_v4.cmake
2008-04-05 17:59Andreas PakulatNote Added: 0011074
2008-04-05 17:59Andreas PakulatFile Added: FindBoost_v5.cmake
2008-04-05 18:09Andreas PakulatFile Added: FindBoost_v6.cmake
2008-04-05 18:11Andreas PakulatFile Added: FindBoost_v7.cmake
2008-04-05 18:12Andreas PakulatNote Added: 0011075
2008-04-07 19:18Andreas PakulatNote Added: 0011139
2008-04-07 19:18Andreas PakulatFile Added: FindBoost_v8.cmake
2008-04-08 05:49Andreas PakulatFile Added: FindBoost_v9.cmake
2008-04-08 05:50Andreas PakulatNote Added: 0011150
2008-04-12 11:18Mike JacksonNote Added: 0011272
2008-04-22 13:17Douglas GregorStatusassigned => resolved
2008-04-22 13:17Douglas GregorResolutionopen => fixed
2008-04-22 13:17Douglas GregorNote Added: 0011485
2008-07-03 16:02Douglas GregorStatusresolved => closed
2008-07-03 16:02Douglas GregorFixed in Version => CMake-2-6

Notes
(0010201)
Andreas Pakulat   
2008-01-19 18:13   
Unfortunately the attached file has a few problems, I've just send a request for testing to the cmake list. I'll wait a few days and/or weeks for replies to that thread and then post and updated version that should then work on a variety of platforms/installations
(0010517)
Andreas Pakulat   
2008-02-15 12:11   
Unfortunately I can't upload the same file again (or rather a file with the same name), so I'm going to upload a newer version of FindBoost.cmake under FindBoost_v2.cmake.
(0010518)
Alex Neundorf   
2008-02-15 12:12   
Boost is a big package and I have never used it myself, I think I'm not the best person to care for this module.

Maybe Andreas (Pakulat|Schneider) wants to maintain it ? Or Brad ?

Alex
(0010519)
Andreas Pakulat   
2008-02-15 12:17   
Yes I'm willing to maintain this module.
(0010936)
Andreas Pakulat   
2008-03-27 18:32   
Unfortunately there's still no way to delete old files, so I've uploaded _v3.cmake which contains a few fixes (that I forgot to copy from the kde version) and some fixes suggested by Matthias Vallentin and Matthew Woehlke.
(0011073)
Andreas Pakulat   
2008-04-05 13:16   
Another update to the file, input from Matthew Woehlke and Matthias Vallentin.
(0011074)
Andreas Pakulat   
2008-04-05 17:59   
Added compatibility mode for CMake 2.4 backwards compatibility for Boost_LIBRARY_DIRS in the v5 version.
(0011075)
Andreas Pakulat   
2008-04-05 18:12   
Also set the Boost_LIB_DIAGNOSTIC_DEFINITIONS variable (as a cache variable) on windows, just as the existing module does.
(0011139)
Andreas Pakulat   
2008-04-07 19:18   
Thanks to Mathias Dalheimer and Timenkov Yuri I found a way to force CMake into finding the static versions of the boost libraries. This is something that seems to be quite common around the projects that use boost. The v8 version allows to set a variable that enables preference of static libs over shared libs.
(0011150)
Andreas Pakulat   
2008-04-08 05:50   
Another small update: Support MSVC9 and also look for boost libs with version number 1.35.0
(0011272)
Mike Jackson   
2008-04-12 11:18   
Ok. I downloaded the latest CMake nightly (2.7-20080412) and gave this FindBoost a shot with a MinGW current Stable release, which is I think 3.14, at least according to the _mingw.h file.

It didn't work. Here are the changes. Sorry, but I don't have a decent diff generator on this windows box so you will have to merge stuff in:

Around line 347:
  IF (MINGW)
    EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
        ARGS --version
        OUTPUT_VARIABLE _boost_COMPILER_VERSION
    )
    STRING(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.[0-9] .*" "\\1\\2"
           _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
    SET (_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
  ENDIF(MINGW)

This is because Boost throws in the GCC version.

Next around line 385:
  SET( _boost_STATIC_TAG "")
  IF (WIN32)
    IF (MSVC)
        SET (_boost_ABI_TAG "g")
    ENDIF (MSVC)
    IF( Boost_USE_STATIC_LIBS )
      SET( _boost_STATIC_TAG "-s")
    ENDIF( Boost_USE_STATIC_LIBS )
  ENDIF(WIN32)
  SET (_boost_ABI_TAG "${_boost_ABI_TAG}d")

It seems that only MSVC uses the "g" ABI tag, at least that is what I found through trial and error on my system.

Adding these changes results in the FindBoost.cmake looking for libraries of the form:
#-- Release
libboost_filesystem-mgw34-mt-1_34_1
libboost_filesystem-mgw34-mt-s-1_34_1
libboost_filesystem-mt
libboost_filesystem-mt-s
libboost_filesystem
#-- Debug
libboost_filesystem-mgw34-mt-d-1_34_1
libboost_filesystem-mgw34-mt-sd-1_34_1
libboost_filesystem-mt-d
libboost_filesystem-mt-sd
libboost_filesystem-d

Which correspond to what is on my system, at least for the static case.

Someone want to put these changes into this?
(0011485)
Douglas Gregor   
2008-04-22 13:17   
All of these changes have been merged into CMake CVS.