Added CMake support for local OpenThreads build

This commit is contained in:
Robert Osfield 2007-05-02 18:07:41 +00:00
parent d9ee7cabd9
commit 958c3efa3a
3 changed files with 4 additions and 32 deletions

View File

@ -33,37 +33,6 @@ IF(USING_OSG_OP_OT_TRIPLE_SET)
ENDIF(USING_OSG_OP_OT_TRIPLE_SET) ENDIF(USING_OSG_OP_OT_TRIPLE_SET)
# FIXME: The FindOpenThreads stuff below is not quite correct.
# The problem is that if we are building OpenSceneGraph by itself
# (not part of the triple-set OT/OP/OSG source), then we need to hunt
# down the OpenThreads library on the system.
# But if we are building as part of the triple-set, then we want to
# refer to the version in the triple set. But this gets harder because
# FIND_LIBRARY will fail to pick the triple set version in this case
# because the library is not yet built when running this CMake script.
#
# Maybe we need a global flag (set in the root CMakeLists.txt)
# that tells us which scenario we are doing.
# And in the triple set case, we skip this check.
IF(USING_OSG_OP_OT_TRIPLE_SET)
# MESSAGE("OSG: Using TripleSet, ${OpenThreads_SOURCE_DIR}.")
# So I think the fall-out is that all the OpenThreads variables
# that have been set are still in play. So the include paths are still
# visible, and the library is still set.
# To keep the same code paths
SET(OPENTHREADS_LIBRARY OpenThreads)
SET(OPENTHREADS_INCLUDE_DIR ${OpenThreads_SOURCE_DIR}/include)
# MESSAGE("Lib: ${OPENTHREADS_LIBRARY}")
ELSE(USING_OSG_OP_OT_TRIPLE_SET)
# MESSAGE("OSG: Not using Triple Set")
FIND_PACKAGE(OpenThreads REQUIRED)
ENDIF(USING_OSG_OP_OT_TRIPLE_SET)
# Okay, here's the problem: On some platforms, linking against OpenThreads # Okay, here's the problem: On some platforms, linking against OpenThreads
# is not enough and explicit linking to the underlying thread library # is not enough and explicit linking to the underlying thread library
# is also required (e.g. FreeBSD). But OpenThreads may be built with different # is also required (e.g. FreeBSD). But OpenThreads may be built with different
@ -101,7 +70,6 @@ ENDIF(UNIX)
# Make the headers visible to everything # Make the headers visible to everything
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
${OpenSceneGraph_SOURCE_DIR}/include ${OpenSceneGraph_SOURCE_DIR}/include
${OPENTHREADS_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}
) )

View File

@ -1,5 +1,6 @@
SUBDIRS( SUBDIRS(
OpenThreads
osg osg
osgDB osgDB
osgUtil osgUtil

View File

@ -291,6 +291,9 @@ ADD_LIBRARY(${LIB_NAME}
dxtctool.h dxtctool.h
) )
LINK_INTERNAL(${LIB_NAME}
OpenThreads
)
LINK_EXTERNAL(${LIB_NAME} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIBRARY} ) LINK_EXTERNAL(${LIB_NAME} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIBRARY} )
LINK_CORELIB_DEFAULT(${LIB_NAME} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIBRARY} ) LINK_CORELIB_DEFAULT(${LIB_NAME} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIBRARY} )