Changeset 6430

Show
Ignore:
Timestamp:
03/29/07 12:56:07
Author:
robert
Message:

From Eric Wing, added handling of CMAKE_THREAD_LIBS_INIT

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OpenSceneGraph/trunk/CMakeLists.txt

    r6417 r6430  
    4848 
    4949ENDIF(USING_OSG_OP_OT_TRIPLE_SET) 
     50 
     51# Okay, here's the problem: On some platforms, linking against OpenThreads 
     52# is not enough and explicit linking to the underlying thread library  
     53# is also required (e.g. FreeBSD). But OpenThreads may be built with different 
     54# backends (Pthreads, Sproc, Windows) so we don't know what the underlying  
     55# thread library is because some platforms support multiple backends (e.g.  
     56# IRIX supports Sproc and Pthreads). Linking all libraries won't work  
     57# because the libraries may be incompatible. 
     58# So the current solution is to attempt best guess linking and exempt certain  
     59# cases. With IRIX, we're going to hope explicit linking to the underlying 
     60# library is not necessary. We currently don't case for pthreads on Windows 
     61# which might be an issue on things like Cygwin. This may need to be fixed. 
     62FIND_PACKAGE(Threads) 
     63IF(CMAKE_SYSTEM MATCHES IRIX) 
     64        # Erase CMAKE_THREAD_LIBS_INIT and hope it works 
     65        SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")         
     66ENDIF(CMAKE_SYSTEM MATCHES IRIX) 
     67 
    5068 
    5169# Find OpenGL 
     
    108126################################################################################ 
    109127# 3rd Party Dependency Stuff 
    110 IF(MSVC
     128IF(WIN32
    111129        INCLUDE(Find3rdPartyDependencies) 
    112 ENDIF(MSVC
     130ENDIF(WIN32
    113131 
    114132# Common to all platforms: 
     
    165183 
    166184SET(LIB_POSTFIX "") 
    167 if (UNIX AND NOT WIN32
    168   if (CMAKE_SIZEOF_VOID_P MATCHES "8") 
     185IF(UNIX AND NOT WIN32 AND NOT APPLE
     186  IF(CMAKE_SIZEOF_VOID_P MATCHES "8") 
    169187        SET(LIB_POSTFIX "64") 
    170   endif (CMAKE_SIZEOF_VOID_P MATCHES "8") 
    171 endif (UNIX AND NOT WIN32
     188  ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "8") 
     189ENDIF(UNIX AND NOT WIN32 AND NOT APPLE
    172190 
    173191#SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME}) 
  • OpenSceneGraph/trunk/CMakeModules/FindOpenThreads.cmake

    r6424 r6430  
    8181  # MESSAGE("-- Found OpenThreads: "${OPENTHREADS_LIBRARY}) 
    8282  IF(NOT OPENTHREADS_LIBRARY_DEBUG) 
    83        MESSAGE("-- Warning Debug OpenThreads not found, using: ${OPENTHREADS_LIBRARY}") 
     83         # MESSAGE("-- Warning Debug OpenThreads not found, using: ${OPENTHREADS_LIBRARY}") 
    8484        SET(OPENTHREADS_LIBRARY_DEBUG "${OPENTHREADS_LIBRARY}") 
    8585  ENDIF(NOT OPENTHREADS_LIBRARY_DEBUG) 
  • OpenSceneGraph/trunk/src/osg/CMakeLists.txt

    r6402 r6430  
    292292) 
    293293 
    294 LINK_EXTERNAL(${LIB_NAME}     ${MATH_LIBRARY} ) 
    295 LINK_CORELIB_DEFAULT(${LIB_NAME}       ${MATH_LIBRARY} ) 
     294LINK_EXTERNAL(${LIB_NAME} ${CMAKE_THREAD_LIBS_INIT}   ${MATH_LIBRARY} ) 
     295LINK_CORELIB_DEFAULT(${LIB_NAME} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIBRARY} ) 
    296296 
    297297INCLUDE(ModuleInstall OPTIONAL)