Commit 547c0b81 authored by Francois Bleibel's avatar Francois Bleibel
Browse files

Enabled thread support (was disabled before because HAVE_LIBBOOST_THREAD was not defined)

parent bd390fee
......@@ -24,6 +24,9 @@ SET(OS ${CMAKE_SYSTEM_NAME})
#----------------------------------------------------
# --- GENERIC FLAGS ---------------------------------
#----------------------------------------------------
# For CMAKE Modules
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
# Specify the compile flags for the overall library.
IF(WIN32)
SET(LIBDIR_KW "/LIBPATH:")
......@@ -68,6 +71,8 @@ IF(Boost_THREAD_FOUND)
#MESSAGE(STATUS "Boost_THREAD_LIBRARY:" ${Boost_THREAD_LIBRARY})
#MESSAGE(STATUS "Boost_THREAD_LIBRARY_RELEASE:" ${Boost_THREAD_LIBRARY_RELEASE})
#MESSAGE(STATUS "Boost_THREAD_LIBRARY_DEBUG:" ${Boost_THREAD_LIBRARY_DEBUG})
ADD_DEFINITIONS(-DHAVE_LIBBOOST_THREAD)
# Look for the type of pattern to find.
SET(BOOST_PATTERN_TOFIND "")
......@@ -95,6 +100,17 @@ IF(Boost_THREAD_FOUND)
SET(BOOST_THREAD_LIB_NAME ${Boost_THREAD_LIBRARY})
ENDIF(BOOST_PATTERN_TOFIND)
# --- PTHREAD -------------------------------------------------------
FIND_PACKAGE(PTHREAD REQUIRED)
IF(PTHREAD_FOUND)
ADD_DEFINITIONS(-DHAVE_PTHREAD)
IF(UNIX)
ADD_DEFINITIONS(-pthread)
ENDIF(UNIX)
INCLUDE_DIRECTORIES(${PTHREAD_INCLUDE_DIRS})
LINK_DIRECTORIES(${PTHREAD_LIBRARY_DIRS})
ENDIF(PTHREAD_FOUND)
ELSE(Boost_THREAD_FOUND)
MESSAGE("WARNING: Boost thread not found. Trying without the thread library")
FIND_PACKAGE(Boost)
......
#############################################################################
#
# $Id: FindPTHREAD.cmake,v 1.5 2007/03/21 13:59:33 asaunier Exp $
#
# Copyright (C) 1998-2006 Inria. All rights reserved.
#
# This software was developed at:
# IRISA/INRIA Rennes
# Projet Lagadic
# Campus Universitaire de Beaulieu
# 35042 Rennes Cedex
# http://www.irisa.fr/lagadic
#
# This file is part of the ViSP toolkit.
#
# This file may be distributed under the terms of the Q Public License
# as defined by Trolltech AS of Norway and appearing in the file
# LICENSE included in the packaging of this file.
#
# Licensees holding valid ViSP Professional Edition licenses may
# use this file in accordance with the ViSP Commercial License
# Agreement provided with the Software.
#
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# Contact visp@irisa.fr if any conditions of this licensing are
# not clear to you.
#
# Description:
# Try to find pthread library.
# Once run this will define:
#
# PTHREAD_FOUND
# PTHREAD_INCLUDE_DIR
# PTHREAD_LIBRARIES
#
# Authors:
# Fabien Spindler
#
#############################################################################
#IF(NOT UNIX AND NOT WIN32)
# SET(PTHREAD_FOUND FALSE)
#ELSE(NOT UNIX AND NOT WIN32)
FIND_PATH(PTHREAD_INCLUDE_DIR pthread.h
/usr/include
"$ENV{PTHREAD_INCLUDE_PATH}"
"$ENV{PTHREAD_HOME}/include"
)
# pthreadVSE pthreadGCE pthreadGC pthreadVC1 pthreadVC2 are comming from web
FIND_LIBRARY(PTHREAD_LIBRARY
NAMES pthread pthreadGC2 pthreadVSE pthreadGCE pthreadGC pthreadVC1 pthreadVC2
PATHS
/usr/lib
/usr/local/lib
/lib
"$ENV{PTHREAD_LIBRARY_PATH}"
"$ENV{PTHREAD_HOME}/lib"
)
#MESSAGE(STATUS "DBG PTHREAD_LIBRARY=${PTHREAD_LIBRARY}")
## --------------------------------
IF(PTHREAD_LIBRARY)
SET(PTHREAD_LIBRARIES ${PTHREAD_LIBRARY})
ELSE(PTHREAD_LIBRARY)
#MESSAGE(SEND_ERROR "pthread library not found.")
ENDIF(PTHREAD_LIBRARY)
IF(NOT PTHREAD_INCLUDE_DIR)
#MESSAGE(SEND_ERROR "pthread include dir not found.")
ENDIF(NOT PTHREAD_INCLUDE_DIR)
IF(PTHREAD_LIBRARIES AND PTHREAD_INCLUDE_DIR)
SET(PTHREAD_FOUND TRUE)
ELSE(PTHREAD_LIBRARIES AND PTHREAD_INCLUDE_DIR)
SET(PTHREAD_FOUND FALSE)
ENDIF(PTHREAD_LIBRARIES AND PTHREAD_INCLUDE_DIR)
#MARK_AS_ADVANCED(
# PTHREAD_INCLUDE_DIR
# PTHREAD_LIBRARIES
# )
#MESSAGE(STATUS "PTHREAD_FOUND : ${PTHREAD_FOUND}")
#ENDIF(NOT UNIX AND NOT WIN32)
......@@ -46,7 +46,7 @@ SET_TARGET_PROPERTIES(${LIBRARY_NAME}
)
IF (UNIX)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} dl)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} dl pthread)
ENDIF (UNIX)
INSTALL(TARGETS ${LIBRARY_NAME}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment