View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006257CMakeModulespublic2008-01-17 15:102008-07-03 16:02
ReporterAndreas Pakulat 
Assigned ToBill Hoffman 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in VersionCMake-2-6 
Summary0006257: Improvements to FindBoost.cmake
DescriptionBased 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.
TagsNo tags attached.
Attached Files? file icon FindBoost.cmake [^] (12,645 bytes) 2008-01-17 15:10
? file icon FindBoost_v2.cmake [^] (20,366 bytes) 2008-02-15 12:13
? file icon FindBoost_v3.cmake [^] (21,368 bytes) 2008-03-27 18:31
? file icon FindBoost_v4.cmake [^] (22,275 bytes) 2008-04-05 13:16
? file icon FindBoost_v5.cmake [^] (23,803 bytes) 2008-04-05 17:59
? file icon FindBoost_v6.cmake [^] (25,188 bytes) 2008-04-05 18:09
? file icon FindBoost_v7.cmake [^] (25,227 bytes) 2008-04-05 18:11
? file icon FindBoost_v8.cmake [^] (26,038 bytes) 2008-04-07 19:18
? file icon FindBoost_v9.cmake [^] (26,139 bytes) 2008-04-08 05:49

 Relationships

  Notes
(0010201)
Andreas Pakulat (reporter)
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 (reporter)
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 (developer)
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 (reporter)
2008-02-15 12:17

Yes I'm willing to maintain this module.
(0010936)
Andreas Pakulat (reporter)
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 (reporter)
2008-04-05 13:16

Another update to the file, input from Matthew Woehlke and Matthias Vallentin.
(0011074)
Andreas Pakulat (reporter)
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 (reporter)
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 (reporter)
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 (reporter)
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 (reporter)
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 (developer)
2008-04-22 13:17

All of these changes have been merged into CMake CVS.

 Issue History
Date Modified Username Field Change
2008-01-17 15:10 Andreas Pakulat New Issue
2008-01-17 15:10 Andreas Pakulat File Added: FindBoost.cmake
2008-01-19 18:13 Andreas Pakulat Note Added: 0010201
2008-02-15 10:42 Bill Hoffman Status new => assigned
2008-02-15 10:42 Bill Hoffman Assigned To => Alex Neundorf
2008-02-15 12:11 Andreas Pakulat Note Added: 0010517
2008-02-15 12:12 Alex Neundorf Note Added: 0010518
2008-02-15 12:12 Alex Neundorf Assigned To Alex Neundorf => Bill Hoffman
2008-02-15 12:12 Alex Neundorf Category CMake => Modules
2008-02-15 12:13 Andreas Pakulat File Added: FindBoost_v2.cmake
2008-02-15 12:17 Andreas Pakulat Note Added: 0010519
2008-03-27 18:31 Andreas Pakulat File Added: FindBoost_v3.cmake
2008-03-27 18:32 Andreas Pakulat Note Added: 0010936
2008-04-05 13:16 Andreas Pakulat Note Added: 0011073
2008-04-05 13:16 Andreas Pakulat File Added: FindBoost_v4.cmake
2008-04-05 17:59 Andreas Pakulat Note Added: 0011074
2008-04-05 17:59 Andreas Pakulat File Added: FindBoost_v5.cmake
2008-04-05 18:09 Andreas Pakulat File Added: FindBoost_v6.cmake
2008-04-05 18:11 Andreas Pakulat File Added: FindBoost_v7.cmake
2008-04-05 18:12 Andreas Pakulat Note Added: 0011075
2008-04-07 19:18 Andreas Pakulat Note Added: 0011139
2008-04-07 19:18 Andreas Pakulat File Added: FindBoost_v8.cmake
2008-04-08 05:49 Andreas Pakulat File Added: FindBoost_v9.cmake
2008-04-08 05:50 Andreas Pakulat Note Added: 0011150
2008-04-12 11:18 Mike Jackson Note Added: 0011272
2008-04-22 13:17 Douglas Gregor Status assigned => resolved
2008-04-22 13:17 Douglas Gregor Resolution open => fixed
2008-04-22 13:17 Douglas Gregor Note Added: 0011485
2008-07-03 16:02 Douglas Gregor Status resolved => closed
2008-07-03 16:02 Douglas Gregor Fixed in Version => CMake-2-6


Copyright © 2000 - 2018 MantisBT Team