MantisBT - CMake
View Issue Details
0014720CMakeModulespublic2014-01-27 10:272014-06-02 08:38
Arne Nordmann 
 
normalcrashalways
closedfixed 
64bitLinux Ubuntuprecise+quantal
CMake 2.8.7 
CMake 2.8.11 
0014720: FindBoost handles pthread different on first and second run
When calling the macro find_package(Boost thread), I get different results for ${Boost_LIBRARIES} the first and the second time I execute cmake.

First time, ${Boost_LIBRARIES} contains '/usr/lib/libboost_thread-mt.so;pthread', the second time, ${Boost_LIBRARIES} just contains '/usr/lib/libboost_thread-mt.so' (without pthread).
Execute the following cmake script twice (also attached):

> project("Test FindBoost")
> cmake_minimum_required(VERSION 2.8)
> find_package(Boost REQUIRED thread)
> message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}")

Reproduced on several Ubuntu precise and quantal machines.
An obvious workaround, calling the find boost macro twice in a cmake script, doesn't help.
No tags attached.
related to 0010692closed Philip Lowman FindBoost fails to add -lpthread 
txt CMakeLists.txt (154) 2014-01-27 10:27
https://public.kitware.com/Bug/file/5052/CMakeLists.txt
Issue History
2014-01-27 10:27Arne NordmannNew Issue
2014-01-27 10:27Arne NordmannFile Added: CMakeLists.txt
2014-01-27 10:44Brad KingNote Added: 0034998
2014-01-27 10:46Nils GladitzRelationship addedrelated to 0010692
2014-01-27 10:46Nils GladitzNote Added: 0034999
2014-01-27 10:58Arne NordmannNote Added: 0035000
2014-01-27 11:07Brad KingNote Added: 0035001
2014-01-27 11:07Brad KingStatusnew => resolved
2014-01-27 11:07Brad KingResolutionopen => fixed
2014-01-27 11:07Brad KingFixed in Version => CMake 2.8.11
2014-06-02 08:38Robert MaynardNote Added: 0036091
2014-06-02 08:38Robert MaynardStatusresolved => closed

Notes
(0034998)
Brad King   
2014-01-27 10:44   
The FindBoost module has had a major overhaul since 2.8.7.

Please try with CMake 2.8.11 or higher, preferably the latest release.
(0034999)
Nils Gladitz   
2014-01-27 10:46   
When I run vanilla cmake 2.8.12.1 I get:
  -- Boost_LIBRARIES: /usr/lib/libboost_thread.so
both on the first and second run.

Debian/Ubuntu seem to patch their FindBoost.cmake to add pthread:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=563479 [^]
(0035000)
Arne Nordmann   
2014-01-27 10:58   
I tested in a Ubuntu saucy VM with cmake 2.8.11.2 (which comes with saucy). First and second run produce the same result, which is

 -- Boost_LIBRARIES: /usr/lib/x86_64-linux-gnu/libboost_thread.so;/usr/lib/x86_64-linux-gnu/libpthread.so

which is fine.
(0035001)
Brad King   
2014-01-27 11:07   
Re 0014720:0035000: Great, thanks for reporting back.
(0036091)
Robert Maynard   
2014-06-02 08:38   
Closing resolved issues that have not been updated in more than 4 months.