Ticket #25145: patch-config-check_depend.cmake.diff

File patch-config-check_depend.cmake.diff, 2.0 KB (added by kiwi.2008@…, 14 years ago)
  • config/check_depend.

    old new  
    143143if(OROCOS_TARGET STREQUAL "macosx")
    144144  set(OROPKG_OS_MACOSX TRUE CACHE INTERNAL "This variable is exported to the rtt-config.h file to expose our target choice to the code." FORCE)
    145145
    146   find_package(Boost 1.33 COMPONENTS thread REQUIRED)
    147   list(APPEND OROCOS-RTT_INCLUDE_DIRS ${Boost_thread_INCLUDE_DIRS} )
     146  if (NOT Boost_THREAD_FOUND)
     147        find_package(Boost 1.33 COMPONENTS thread REQUIRED)
     148  endif ()
     149  list(APPEND OROCOS-RTT_INCLUDE_DIRS ${Boost_THREAD_INCLUDE_DIRS} )
     150 
     151  # add to list of libraries in pkgconfig file
     152  # As Boost_THREAD_LIBRARY may be a list of libraries, and we can't deal
     153  # with that in pkgconfig, we take 1) the library for this build type, or
     154  # 2) the library if only one is listed, or 3) we error out.
     155  STRING(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER)
     156  if (DEFINED Boost_THREAD_LIBRARY_${CMAKE_BUILD_TYPE_UPPER})
     157        LIST(APPEND OROCOS-RTT_USER_LINK_LIBS ${Boost_THREAD_LIBRARY_${CMAKE_BUILD_TYPE_UPPER}})
     158  else (DEFINED Boost_THREAD_LIBRARY_${CMAKE_BUILD_TYPE_UPPER})
     159        LIST(LENGTH Boost_THREAD_LIBRARY COUNT_Boost_THREAD_LIBRARY)
     160        if (1 LESS COUNT_Boost_THREAD_LIBRARY)
     161          MESSAGE(FATAL_ERROR "Found multiple boost thread libraries, but not one specific to the current build type '${CMAKE_BUILD_TYPE_UPPER}'.")
     162        endif (1 LESS COUNT_Boost_THREAD_LIBRARY)
     163        LIST(APPEND OROCOS-RTT_USER_LINK_LIBS ${Boost_THREAD_LIBRARY}})
     164  endif (DEFINED Boost_THREAD_LIBRARY_${CMAKE_BUILD_TYPE_UPPER})
    148165
    149166  message( "Forcing ORO_OS_USE_BOOST_THREAD to ON")
    150167  set( ORO_OS_USE_BOOST_THREAD ON CACHE BOOL "Forced enable use of Boost.thread on macosx." FORCE)
    151168
     169  # see also src/CMakeLists.txt as it adds the boost_thread library to OROCOS_RTT_LIBRARIES
    152170  list(APPEND OROCOS-RTT_LIBRARIES ${PTHREAD_LIBRARIES})
    153171  list(APPEND OROCOS-RTT_DEFINITIONS "OROCOS_TARGET=${OROCOS_TARGET}")
    154172else()