1 # OpenThreads is a C++ based threading library. Its largest userbase
2 # seems to OpenSceneGraph so you might notice I accept OSGDIR as an
4 # I consider this part of the Findosg* suite used to find OpenSceneGraph
6 # Each component is separate and you must opt in to each module.
11 # OPENTHREADS_FOUND, if false, do not try to link to OpenThreads
12 # OPENTHREADS_INCLUDE_DIR, where to find the headers
14 # $OPENTHREADS_DIR is an environment variable that would
15 # correspond to the ./configure --prefix=$OPENTHREADS_DIR
16 # used in building osg.
18 # Created by Eric Wing.
20 # Header files are presumed to be included like
21 # #include <OpenThreads/Thread>
23 # To make it easier for one-step automated configuration/builds,
24 # we leverage environmental paths. This is preferable
25 # to the -DVAR=value switches because it insulates the
26 # users from changes we may make in this script.
27 # It also offers a little more flexibility than setting
28 # the CMAKE_*_PATH since we can target specific components.
29 # However, the default CMake behavior will search system paths
30 # before anything else. This is problematic in the cases
31 # where you have an older (stable) version installed, but
32 # are trying to build a newer version.
33 # CMake doesn't offer a nice way to globally control this behavior
34 # so we have to do a nasty "double FIND_" in this module.
35 # The first FIND disables the CMAKE_ search paths and only checks
36 # the environmental paths.
37 # If nothing is found, then the second find will search the
38 # standard install paths.
39 # Explicit -DVAR=value arguments should still be able to override everything.
41 FIND_PATH(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
43 $ENV{OPENTHREADS_INCLUDE_DIR}
44 $ENV{OPENTHREADS_DIR}/include
57 /opt/local/include # DarwinPorts
58 /opt/csw/include # Blastwave
60 [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]/include
61 [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
65 FIND_LIBRARY(OPENTHREADS_LIBRARY
66 NAMES OpenThreads OpenThreadsWin32
68 $ENV{OPENTHREADS_LIBRARY_DIR}
69 $ENV{OPENTHREADS_DIR}/lib64
70 $ENV{OPENTHREADS_DIR}/lib
94 [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]/lib
95 [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
99 FIND_LIBRARY(OPENTHREADS_LIBRARY_DEBUG
100 NAMES OpenThreadsd OpenThreadsWin32d
102 $ENV{OPENTHREADS_DEBUG_LIBRARY_DIR}
103 $ENV{OPENTHREADS_LIBRARY_DIR}
104 $ENV{OPENTHREADS_DIR}/lib64
105 $ENV{OPENTHREADS_DIR}/lib
106 $ENV{OPENTHREADS_DIR}
107 $ENV{OSG_LIBRARY_DIR}
127 [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]/lib
128 [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
132 IF(OPENTHREADS_LIBRARY)
133 IF(NOT OPENTHREADS_LIBRARY_DEBUG)
134 #MESSAGE("-- Warning Debug OpenThreads not found, using: ${OPENTHREADS_LIBRARY}")
135 #SET(OPENTHREADS_LIBRARY_DEBUG "${OPENTHREADS_LIBRARY}")
136 SET(OPENTHREADS_LIBRARY_DEBUG "${OPENTHREADS_LIBRARY}" CACHE FILEPATH "Debug version of OpenThreads Library (use regular version if not available)" FORCE)
137 ENDIF(NOT OPENTHREADS_LIBRARY_DEBUG)
138 ENDIF(OPENTHREADS_LIBRARY)
140 SET(OPENTHREADS_FOUND "NO")
141 IF(OPENTHREADS_INCLUDE_DIR AND OPENTHREADS_LIBRARY)
142 SET(OPENTHREADS_FOUND "YES")
143 # MESSAGE("-- Found OpenThreads: "${OPENTHREADS_LIBRARY})
144 ENDIF(OPENTHREADS_INCLUDE_DIR AND OPENTHREADS_LIBRARY)