MantisBT - CMake
View Issue Details
0011121CMakeModulespublic2010-08-12 07:282010-11-09 22:57
Sam Morris 
Philip Lowman 
normalminoralways
closedfixed 
CMake-2-8 
CMake 2.8.3CMake 2.8.3 
0011121: FindBoost does not find boost_thread libraries containing explicit THREADAPI
When building boost it generated the following library files:

libboost_thread_win32-mgw45-mt-1_43.a
libboost_thread_win32-mgw45-mt-1_43.dll
libboost_thread_win32-mgw45-mt-1_43.dll.a
libboost_thread_win32-mgw45-mt.a
libboost_thread_win32-mgw45-mt.dll.a

FindBoost.cmake does not work when called with the thread component, however, because it does not expect to see _win32 inserted into the filename.

I had to make symlinks such as 'libboost_thread-mgw45-mt.dll.a' to get it to work.
I'm cross-compiling boost with the following command:

bjam --with-thread --layout=versioned toolset=gcc target-os=windows threadapi=win32

Without setting threadapi Boost tries to use pthreads by default. I guess this is because it tries to guess the default threadapi value based on the build system and not the host system. Setting threadapi manually causes Boost to think it's not being set to the default value and hence it changes the name of the library file.

This exact detail may be a Boost issue, however CMake should be able to configure projects to link against boost_thread with a non-default threadapi.
No tags attached.
? FindBoost.cmake.6 (54,303) 2010-09-08 23:33
https://public.kitware.com/Bug/file/3372/*
Issue History
2010-08-12 07:28Sam MorrisNew Issue
2010-08-19 08:22Philip LowmanStatusnew => assigned
2010-08-19 08:22Philip LowmanAssigned To => Philip Lowman
2010-09-08 02:03Philip LowmanNote Added: 0022128
2010-09-08 04:58Sam MorrisNote Added: 0022130
2010-09-08 09:00Philip LowmanNote Added: 0022131
2010-09-08 23:33Philip LowmanFile Added: FindBoost.cmake.6
2010-09-08 23:35Philip LowmanNote Added: 0022151
2010-09-10 08:41Philip LowmanETAnone => < 1 day
2010-09-10 08:41Philip LowmanTarget Version => CMake 2.8.3
2010-09-10 08:41Philip LowmanSummaryFindBoost does not work with DLLs with 'lib' filename prefix => FindBoost does not find boost_thread libraries containing explicit THREADAPI
2010-09-12 22:28Philip LowmanNote Added: 0022197
2010-09-12 22:28Philip LowmanStatusassigned => resolved
2010-09-12 22:28Philip LowmanFixed in Version => CMake 2.8.3
2010-09-12 22:28Philip LowmanResolutionopen => fixed
2010-11-09 22:57Philip LowmanStatusresolved => closed

Notes
(0022128)
Philip Lowman   
2010-09-08 02:03   
I'm having problems finding any documentation for Boost on this threadapi parameter and what generated filenames are.

Is it true to say that "libboost_thread-<compiler>-<mt>..." is always pthreads and "libboost_thread_win32-<compiler>-<mt>..." is always win32 threads?
(0022130)
Sam Morris   
2010-09-08 04:58   
Yes I don't think there is any documentation.

IME, it's more like:

  libboost_thread-<compiler>-<mt>(-<threadapi>)

where the portion in the parentheses only appears if the chosen threadapi is not the default for the platform. The oddity is that I'm cross compiling on a POSIX system, so the build system seems to think I should be using pthreads by default.
(0022131)
Philip Lowman   
2010-09-08 09:00   
I assume you can compile boost-thread against pthreads-win32 or Windows Threads with MinGW (or will one day if this isn't possible)?

I can add a variable called Boost_THREADAPI that if set causes FindBoost to search for the following if it encounters the thread component.
libboost_thread-<compiler>-<mt>(-<threadapi>)

The only question would be should we fall back on the version of the non <threadapi> if the variable is set.
(0022151)
Philip Lowman   
2010-09-08 23:35   
Could you please try the version of FindBoost I just uploaded (and set Boost_THREADAPI) to see if it fixes your problems?

I did check and Boost.Thread seems to support pthreads-win32 from the look of it's Bjam config files. Since there is no way for us to know which thread api the user actually wants to link against, the variable seems the best solution for now.
(0022197)
Philip Lowman   
2010-09-12 22:28   
Fix will be in CMake 2.8.3 RC1