source: CMakeModules/BoostPthreadWorkaround.cmake@ 10700

Last change on this file since 10700 was 10700, checked in by Michael Tänzer, 12 years ago

Merge CMake branch into trunk

File size: 2.5 KB
Line 
1# - Work around improper pthread library specification by FindBoost
2# FindBoost only adds pthreads to the libraries to link to on the first run
3# of CMake and also does not do that via a path but as a base_library_name
4# (i.e. pthread instead of /usr/lib/libpthread.a) which causes problems when
5# linking statically
6#
7# Include this file after the FindBoost call that includes the thread component
8
9# [License]
10# The Ariba-Underlay Copyright
11#
12# Copyright (c) 2008-2012, Institute of Telematics, UniversitÀt Karlsruhe (TH)
13#
14# Institute of Telematics
15# UniversitÀt Karlsruhe (TH)
16# Zirkel 2, 76128 Karlsruhe
17# Germany
18#
19# Redistribution and use in source and binary forms, with or without
20# modification, are permitted provided that the following conditions are
21# met:
22#
23# 1. Redistributions of source code must retain the above copyright
24# notice, this list of conditions and the following disclaimer.
25# 2. Redistributions in binary form must reproduce the above copyright
26# notice, this list of conditions and the following disclaimer in the
27# documentation and/or other materials provided with the distribution.
28#
29# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
30# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
32# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
33# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
34# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
35# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
36# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
37# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
38# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40#
41# The views and conclusions contained in the software and documentation
42# are those of the authors and should not be interpreted as representing
43# official policies, either expressed or implied, of the Institute of
44# Telematics.
45# [License]
46
47
48list(REMOVE_ITEM Boost_LIBRARIES pthread)
49
50# On Unix platforms (excluding cygwin) add pthreads to Boost_LIBRARIES
51if(UNIX AND NOT CYGWIN)
52 find_library(BOOST_THREADING_LIBRARY NAMES pthread
53 DOC "The threading library used by boost-thread"
54 )
55 mark_as_advanced(BOOST_THREADING_LIBRARY)
56
57 if(BOOST_THREADING_LIBRARY)
58 list(APPEND Boost_LIBRARIES "${BOOST_THREADING_LIBRARY}")
59 endif()
60endif()
Note: See TracBrowser for help on using the repository browser.