Commit de5e4ed5 authored by Olivier Stasse's avatar Olivier Stasse
Browse files

Add detection of boost.

parent 3265f81d
......@@ -61,7 +61,52 @@ ENDIF (\"${CMAKE_BUILD_TYPE}\" STREQUAL \"\")
OPTION(BUILD_SHARED_LIBS "Build ${PROJECT_NAME} with shared libraries." ON)
OPTION(GENERATE_DOC "Generate html documentation" OFF)
OPTION(USE_BOOST "Compile with boost." ON)
# --- BOOST ---------------------------------------------------
SET(Boost_THREAD_FOUND 0)
FIND_PACKAGE(Boost COMPONENTS thread)
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})
# Look for the type of pattern to find.
SET(BOOST_PATTERN_TOFIND "")
IF(${CMAKE_BUILD_TYPE} MATCHES RELEASE)
SET(BOOST_PATTERN_TOFIND optimized)
ENDIF(${CMAKE_BUILD_TYPE} MATCHES RELEASE)
IF(${CMAKE_BUILD_TYPE} MATCHES DEBUG)
SET(BOOST_PATTERN_TOFIND debug)
ENDIF(${CMAKE_BUILD_TYPE} MATCHES DEBUG)
IF(BOOST_PATTERN_TOFIND)
SET(BOOST_THREAD_LIST_LENGTH 0)
LIST(LENGTH Boost_THREAD_LIBRARY BOOST_THREAD_LIST_LENGTH)
# Debug or optimized library.
IF(${BOOST_THREAD_LIST_LENGTH} MATCHES 4)
LIST(FIND Boost_THREAD_LIBRARY ${BOOST_PATTERN_TOFIND} BTLB_index)
LIST(REMOVE_AT Boost_THREAD_LIBRARY ${BTLB_index})
LIST(GET Boost_THREAD_LIBRARY ${BTLB_index} BOOST_THREAD_LIB_NAME)
# Default strategy
ELSE(${BOOST_THREAD_LIST_LENGTH} MATCHES 4)
SET(BOOST_THREAD_LIB_NAME ${Boost_THREAD_LIBRARY})
ENDIF(${BOOST_THREAD_LIST_LENGTH} MATCHES 4)
# Default strategy
ELSE(BOOST_PATTERN_TOFIND)
SET(BOOST_THREAD_LIB_NAME ${Boost_THREAD_LIBRARY})
ENDIF(BOOST_PATTERN_TOFIND)
ELSE(Boost_THREAD_FOUND)
MESSAGE("WARNING: Boost thread not found. Trying without the thread library")
FIND_PACKAGE(Boost)
IF(NOT Boost_FOUND)
MESSAGE(SEND_ERROR "!! ERROR: Boost not found.")
ENDIF(NOT Boost_FOUND)
ENDIF(Boost_THREAD_FOUND)
MESSAGE(STATUS "Boost thread lib name: ${BOOST_THREAD_LIB_NAME} ${Boost_THREAD_LIBRARY}")
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
#
# Look for dependencies
......
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