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.
19 # The CMake variables OPENTHREADS_DIR or OSG_DIR can now be used as well to influence
20 # detection, instead of needing to specify an environment variable.
22 # Created by Eric Wing.
24 #=============================================================================
25 # Copyright 2007-2009 Kitware, Inc.
26 # Copyright 2012 Philip Lowman <philip@yhbt.com>
28 # Distributed under the OSI-approved BSD License (the "License");
29 # see accompanying file Copyright.txt for details.
31 # This software is distributed WITHOUT ANY WARRANTY; without even the
32 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
33 # See the License for more information.
34 #=============================================================================
35 # (To distribute this file outside of CMake, substitute the full
36 # License text for the above reference.)
38 # Header files are presumed to be included like
39 # #include <OpenThreads/Thread>
41 # To make it easier for one-step automated configuration/builds,
42 # we leverage environmental paths. This is preferable
43 # to the -DVAR=value switches because it insulates the
44 # users from changes we may make in this script.
45 # It also offers a little more flexibility than setting
46 # the CMAKE_*_PATH since we can target specific components.
47 # However, the default CMake behavior will search system paths
48 # before anything else. This is problematic in the cases
49 # where you have an older (stable) version installed, but
50 # are trying to build a newer version.
51 # CMake doesn't offer a nice way to globally control this behavior
52 # so we have to do a nasty "double FIND_" in this module.
53 # The first FIND disables the CMAKE_ search paths and only checks
54 # the environmental paths.
55 # If nothing is found, then the second find will search the
56 # standard install paths.
57 # Explicit -DVAR=value arguments should still be able to override everything.
59 find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
61 ENV OPENTHREADS_INCLUDE_DIR
72 /opt/local # DarwinPorts
80 find_library(OPENTHREADS_LIBRARY
81 NAMES OpenThreads OpenThreadsWin32
83 ENV OPENTHREADS_LIBRARY_DIR
101 find_library(OPENTHREADS_LIBRARY_DEBUG
102 NAMES OpenThreadsd OpenThreadsWin32d
104 ENV OPENTHREADS_DEBUG_LIBRARY_DIR
105 ENV OPENTHREADS_LIBRARY_DIR
123 if(OPENTHREADS_LIBRARY_DEBUG)
124 set(OPENTHREADS_LIBRARIES
125 optimized ${OPENTHREADS_LIBRARY}
126 debug ${OPENTHREADS_LIBRARY_DEBUG})
128 set(OPENTHREADS_LIBRARIES ${OPENTHREADS_LIBRARY})
131 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
132 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenThreads DEFAULT_MSG
133 OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR)