فهرست منبع

BUG: Fixed Issue #7331 Bugs in Findosg*.cmake. Also added OPENTHREADS_LIBRARIES.

Philip Lowman 17 سال پیش
والد
کامیت
d1640b11de

+ 14 - 18
Modules/FindOpenThreads.cmake

@@ -38,7 +38,7 @@
 # standard install paths.
 # Explicit -DVAR=value arguments should still be able to override everything.
 
-FIND_PATH(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
+find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
     HINTS
     $ENV{OPENTHREADS_INCLUDE_DIR}
     $ENV{OPENTHREADS_DIR}/include
@@ -62,7 +62,7 @@ FIND_PATH(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
 )
 
 
-FIND_LIBRARY(OPENTHREADS_LIBRARY 
+find_library(OPENTHREADS_LIBRARY 
     NAMES OpenThreads OpenThreadsWin32 
     HINTS
     $ENV{OPENTHREADS_LIBRARY_DIR}
@@ -95,8 +95,7 @@ FIND_LIBRARY(OPENTHREADS_LIBRARY
     [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
 )
 
-
-FIND_LIBRARY(OPENTHREADS_LIBRARY_DEBUG 
+find_library(OPENTHREADS_LIBRARY_DEBUG 
     NAMES OpenThreadsd OpenThreadsWin32d
     HINTS
     $ENV{OPENTHREADS_DEBUG_LIBRARY_DIR}
@@ -128,18 +127,15 @@ FIND_LIBRARY(OPENTHREADS_LIBRARY_DEBUG
     [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
 )
 
+if(OPENTHREADS_LIBRARY_DEBUG)
+    set(OPENTHREADS_LIBRARIES
+        optimized ${OPENTHREADS_LIBRARY}
+        debug ${OPENTHREADS_LIBRARY_DEBUG})
+else()
+    set(OPENTHREADS_LIBRARY_DEBUG ${OPENTHREADS_LIBRARY})
+    set(OPENTHREADS_LIBRARIES ${OPENTHREADS_LIBRARY})
+endif()
 
-IF(OPENTHREADS_LIBRARY)
-  IF(NOT OPENTHREADS_LIBRARY_DEBUG)
-      #MESSAGE("-- Warning Debug OpenThreads not found, using: ${OPENTHREADS_LIBRARY}")
-      #SET(OPENTHREADS_LIBRARY_DEBUG "${OPENTHREADS_LIBRARY}")
-      SET(OPENTHREADS_LIBRARY_DEBUG "${OPENTHREADS_LIBRARY}" CACHE FILEPATH "Debug version of OpenThreads Library (use regular version if not available)" FORCE)
-  ENDIF(NOT OPENTHREADS_LIBRARY_DEBUG)
-ENDIF(OPENTHREADS_LIBRARY)
-    
-SET(OPENTHREADS_FOUND "NO")
-IF(OPENTHREADS_INCLUDE_DIR AND OPENTHREADS_LIBRARY)
-  SET(OPENTHREADS_FOUND "YES")
-  # MESSAGE("-- Found OpenThreads: "${OPENTHREADS_LIBRARY})
-ENDIF(OPENTHREADS_INCLUDE_DIR AND OPENTHREADS_LIBRARY)
-
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENTHREADS DEFAULT_MSG
+    OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR)

+ 12 - 43
Modules/Findosg.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osg
 # This module defines
-# OSG_LIBRARY
-# OSG_FOUND, if false, do not try to link to osg
-# OSG_INCLUDE_DIR, where to find the headers
+#
+# OSG_FOUND - Was the Osg found?
+# OSG_INCLUDE_DIR - Where to find the headers
+# OSG_LIBRARIES - The libraries to link against for the OSG (use this)
+#
+# OSG_LIBRARY - The OSG library
+# OSG_LIBRARY_DEBUG - The OSG debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,44 +29,9 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgUtil/SceneView>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSG_INCLUDE_DIR osg/PositionAttitudeTransform
-  HINTS
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSG_LIBRARY 
-  NAMES osg
-  HINTS
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSG_FOUND "NO")
-IF(OSG_LIBRARY AND OSG_INCLUDE_DIR)
-  SET(OSG_FOUND "YES")
-ENDIF(OSG_LIBRARY AND OSG_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSG osg/PositionAttitudeTransform)
+OSG_FIND_LIBRARY(OSG osg)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSG DEFAULT_MSG OSG_LIBRARY OSG_INCLUDE_DIR)

+ 38 - 0
Modules/FindosgAnimation.cmake

@@ -0,0 +1,38 @@
+# This is part of the Findosg* suite used to find OpenSceneGraph components.
+# Each component is separate and you must opt in to each module. You must 
+# also opt into OpenGL and OpenThreads (and Producer if needed) as these 
+# modules won't do it for you. This is to allow you control over your own 
+# system piece by piece in case you need to opt out of certain components
+# or change the Find behavior for a particular module (perhaps because the
+# default FindOpenGL.cmake module doesn't work with your system as an
+# example).
+# If you want to use a more convenient module that includes everything,
+# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+# 
+# Locate osgAnimation
+# This module defines
+#
+# OSGANIMATION_FOUND - Was osgAnimation found?
+# OSGANIMATION_INCLUDE_DIR - Where to find the headers
+# OSGANIMATION_LIBRARIES - The libraries to link against for the OSG (use this)
+#
+# OSGANIMATION_LIBRARY - The OSG library
+# OSGANIMATION_LIBRARY_DEBUG - The OSG debug library
+#
+# $OSGDIR is an environment variable that would
+# correspond to the ./configure --prefix=$OSGDIR
+# used in building osg.
+#
+# Created by Eric Wing.
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgAnimation/Animation>
+
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGANIMATION osgAnimation/Animation)
+OSG_FIND_LIBRARY(OSGANIMATION osgAnimation)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGANIMATION DEFAULT_MSG
+    OSGANIMATION_LIBRARY OSGANIMATION_INCLUDE_DIR)

+ 13 - 45
Modules/FindosgDB.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osgDB
 # This module defines
-# OSGDB_LIBRARY
-# OSGDB_FOUND, if false, do not try to link to osgDB
-# OSGDB_INCLUDE_DIR, where to find the headers
+#
+# OSGDB_FOUND - Was osgDB found?
+# OSGDB_INCLUDE_DIR - Where to find the headers
+# OSGDB_LIBRARIES - The libraries to link against for the osgDB (use this)
+#
+# OSGDB_LIBRARY - The osgDB library
+# OSGDB_LIBRARY_DEBUG - The osgDB debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgDB/DatabasePager>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGDB_INCLUDE_DIR osgDB/DatabasePager
-  HINTS
-  $ENV{OSGDB_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGDB_LIBRARY 
-  NAMES osgDB
-  HINTS
-  $ENV{OSGDB_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGDB_FOUND "NO")
-IF(OSGDB_LIBRARY AND OSGDB_INCLUDE_DIR)
-  SET(OSGDB_FOUND "YES")
-ENDIF(OSGDB_LIBRARY AND OSGDB_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGDB osgDB/DatabasePager)
+OSG_FIND_LIBRARY(OSGDB osgDB)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGDB DEFAULT_MSG
+    OSGDB_LIBRARY OSGDB_INCLUDE_DIR)

+ 13 - 45
Modules/FindosgFX.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osgFX
 # This module defines
-# OSGFX_LIBRARY
-# OSGFX_FOUND, if false, do not try to link to osgFX
-# OSGFX_INCLUDE_DIR, where to find the headers
+#
+# OSGFX_FOUND - Was osgFX found?
+# OSGFX_INCLUDE_DIR - Where to find the headers
+# OSGFX_LIBRARIES - The libraries to link against for the osgFX (use this)
+#
+# OSGFX_LIBRARY - The osgFX library
+# OSGFX_LIBRARY_DEBUG - The osgFX debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgFX/BumpMapping>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGFX_INCLUDE_DIR osgFX/BumpMapping
-  HINTS
-  $ENV{OSGFX_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGFX_LIBRARY 
-  NAMES osgFX
-  HINTS
-  $ENV{OSGFX_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGFX_FOUND "NO")
-IF(OSGFX_LIBRARY AND OSGFX_INCLUDE_DIR)
-  SET(OSGFX_FOUND "YES")
-ENDIF(OSGFX_LIBRARY AND OSGFX_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGFX osgFX/BumpMapping)
+OSG_FIND_LIBRARY(OSGFX osgFX)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGFX DEFAULT_MSG
+    OSGFX_LIBRARY OSGFX_INCLUDE_DIR)

+ 13 - 45
Modules/FindosgGA.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osgGA
 # This module defines
-# OSGGA_LIBRARY
-# OSGGA_FOUND, if false, do not try to link to osgGA
-# OSGGA_INCLUDE_DIR, where to find the headers
+#
+# OSGGA_FOUND - Was osgGA found?
+# OSGGA_INCLUDE_DIR - Where to find the headers
+# OSGGA_LIBRARIES - The libraries to link against for the osgGA (use this)
+#
+# OSGGA_LIBRARY - The osgGA library
+# OSGGA_LIBRARY_DEBUG - The osgGA debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgGA/FlightManipulator>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGGA_INCLUDE_DIR osgGA/FlightManipulator
-  HINTS
-  $ENV{OSGGA_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGGA_LIBRARY 
-  NAMES osgGA
-  HINTS
-  $ENV{OSGGA_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGGA_FOUND "NO")
-IF(OSGGA_LIBRARY AND OSGGA_INCLUDE_DIR)
-  SET(OSGGA_FOUND "YES")
-ENDIF(OSGGA_LIBRARY AND OSGGA_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGGA osgGA/FlightManipulator)
+OSG_FIND_LIBRARY(OSGGA osgGA)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGGA DEFAULT_MSG
+    OSGGA_LIBRARY OSGGA_INCLUDE_DIR)

+ 14 - 46
Modules/FindosgIntrospection.cmake

@@ -9,11 +9,15 @@
 # If you want to use a more convenient module that includes everything,
 # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
 # 
-# Locate osgIntrospection
+# Locate osgINTROSPECTION
 # This module defines
-# OSGINTROSPECTION_LIBRARY
-# OSGINTROSPECTION_FOUND, if false, do not try to link to osgIntrospection
-# OSGINTROSPECTION_INCLUDE_DIR, where to find the headers
+#
+# OSGINTROSPECTION_FOUND - Was osgIntrospection found?
+# OSGINTROSPECTION_INCLUDE_DIR - Where to find the headers
+# OSGINTROSPECTION_LIBRARIES - The libraries to link for osgIntrospection (use this)
+#
+# OSGINTROSPECTION_LIBRARY - The osgIntrospection library
+# OSGINTROSPECTION_LIBRARY_DEBUG - The osgIntrospection debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgIntrospection/Reflection>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGINTROSPECTION_INCLUDE_DIR osgIntrospection/Reflection
-  HINTS
-  $ENV{OSGINTROSPECTION_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGINTROSPECTION_LIBRARY 
-  NAMES osgIntrospection
-  HINTS
-  $ENV{OSGINTROSPECTION_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGINTROSPECTION_FOUND "NO")
-IF(OSGINTROSPECTION_LIBRARY AND OSGINTROSPECTION_INCLUDE_DIR)
-  SET(OSGINTROSPECTION_FOUND "YES")
-ENDIF(OSGINTROSPECTION_LIBRARY AND OSGINTROSPECTION_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGINTROSPECTION osgIntrospection/Reflection)
+OSG_FIND_LIBRARY(OSGINTROSPECTION osgIntrospection)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGINTROSPECTION DEFAULT_MSG
+    OSGINTROSPECTION_LIBRARY OSGINTROSPECTION_INCLUDE_DIR)

+ 13 - 45
Modules/FindosgManipulator.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osgManipulator
 # This module defines
-# OSG_LIBRARY
-# OSGMANIPULATOR_FOUND, if false, do not try to link to osgManipulator
-# OSGMANIPULATOR_INCLUDE_DIR, where to find the headers
+#
+# OSGMANIPULATOR_FOUND - Was osgManipulator found?
+# OSGMANIPULATOR_INCLUDE_DIR - Where to find the headers
+# OSGMANIPULATOR_LIBRARIES - The libraries to link for osgManipulator (use this)
+#
+# OSGMANIPULATOR_LIBRARY - The osgManipulator library
+# OSGMANIPULATOR_LIBRARY_DEBUG - The osgManipulator debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgManipulator/TrackballDragger>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGMANIPULATOR_INCLUDE_DIR osgManipulator/TrackballDragger
-  HINTS
-  $ENV{OSGMANIPULATOR_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGMANIPULATOR_LIBRARY 
-  NAMES osgManipulator
-  HINTS
-  $ENV{OSGMANIPULATOR_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGMANIPULATOR_FOUND "NO")
-IF(OSGMANIPULATOR_LIBRARY AND OSGMANIPULATOR_INCLUDE_DIR)
-  SET(OSGMANIPULATOR_FOUND "YES")
-ENDIF(OSGMANIPULATOR_LIBRARY AND OSGMANIPULATOR_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGMANIPULATOR osgManipulator/TrackballDragger)
+OSG_FIND_LIBRARY(OSGMANIPULATOR osgManipulator)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGMANIPULATOR DEFAULT_MSG
+    OSGMANIPULATOR_LIBRARY OSGMANIPULATOR_INCLUDE_DIR)

+ 13 - 45
Modules/FindosgParticle.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osgParticle
 # This module defines
-# OSGPARTICLE_LIBRARY
-# OSGPARTICLE_FOUND, if false, do not try to link to osgParticle
-# OSGPARTICLE_INCLUDE_DIR, where to find the headers
+#
+# OSGPARTICLE_FOUND - Was osgParticle found?
+# OSGPARTICLE_INCLUDE_DIR - Where to find the headers
+# OSGPARTICLE_LIBRARIES - The libraries to link for osgParticle (use this)
+#
+# OSGPARTICLE_LIBRARY - The osgParticle library
+# OSGPARTICLE_LIBRARY_DEBUG - The osgParticle debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgParticle/FireEffect>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGPARTICLE_INCLUDE_DIR osgParticle/FireEffect
-  HINTS
-  $ENV{OSGPARTICLE_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGPARTICLE_LIBRARY 
-  NAMES osgParticle
-  HINTS
-  $ENV{OSGPARTICLE_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGPARTICLE_FOUND "NO")
-IF(OSGPARTICLE_LIBRARY AND OSGPARTICLE_INCLUDE_DIR)
-  SET(OSGPARTICLE_FOUND "YES")
-ENDIF(OSGPARTICLE_LIBRARY AND OSGPARTICLE_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGPARTICLE osgParticle/FireEffect)
+OSG_FIND_LIBRARY(OSGPARTICLE osgParticle)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGPARTICLE DEFAULT_MSG
+    OSGPARTICLE_LIBRARY OSGPARTICLE_INCLUDE_DIR)

+ 13 - 45
Modules/FindosgProducer.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osgProducer
 # This module defines
-# OSGPRODUCER_LIBRARY
-# OSGPRODUCER_FOUND, if false, do not try to link to osgProducer
-# OSGPRODUCER_INCLUDE_DIR, where to find the headers
+#
+# OSGPRODUCER_FOUND - Was osgProducer found?
+# OSGPRODUCER_INCLUDE_DIR - Where to find the headers
+# OSGPRODUCER_LIBRARIES - The libraries to link for osgProducer (use this)
+#
+# OSGPRODUCER_LIBRARY - The osgProducer library
+# OSGPRODUCER_LIBRARY_DEBUG - The osgProducer debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgProducer/OsgSceneHandler>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGPRODUCER_INCLUDE_DIR osgProducer/OsgSceneHandler
-  HINTS
-  $ENV{OSGPRODUCER_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGPRODUCER_LIBRARY 
-  NAMES osgProducer
-  HINTS
-  $ENV{OSGPRODUCER_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGPRODUCER_FOUND "NO")
-IF(OSGPRODUCER_LIBRARY AND OSGPRODUCER_INCLUDE_DIR)
-  SET(OSGPRODUCER_FOUND "YES")
-ENDIF(OSGPRODUCER_LIBRARY AND OSGPRODUCER_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGPRODUCER osgProducer/OsgSceneHandler)
+OSG_FIND_LIBRARY(OSGPRODUCER osgProducer)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGPRODUCER DEFAULT_MSG
+    OSGPRODUCER_LIBRARY OSGPRODUCER_INCLUDE_DIR)

+ 13 - 45
Modules/FindosgShadow.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osgShadow
 # This module defines
-# OSGSHADOW_LIBRARY
-# OSGSHADOW_FOUND, if false, do not try to link to osgShadow
-# OSGSHADOW_INCLUDE_DIR, where to find the headers
+#
+# OSGSHADOW_FOUND - Was osgShadow found?
+# OSGSHADOW_INCLUDE_DIR - Where to find the headers
+# OSGSHADOW_LIBRARIES - The libraries to link for osgShadow (use this)
+#
+# OSGSHADOW_LIBRARY - The osgShadow library
+# OSGSHADOW_LIBRARY_DEBUG - The osgShadow debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgShadow/ShadowTexture>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGSHADOW_INCLUDE_DIR osgShadow/ShadowTexture
-  HINTS
-  $ENV{OSGSHADOW_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGSHADOW_LIBRARY 
-  NAMES osgShadow
-  HINTS
-  $ENV{OSGSHADOW_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGSHADOW_FOUND "NO")
-IF(OSGSHADOW_LIBRARY AND OSGSHADOW_INCLUDE_DIR)
-  SET(OSGSHADOW_FOUND "YES")
-ENDIF(OSGSHADOW_LIBRARY AND OSGSHADOW_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGSHADOW osgShadow/ShadowTexture)
+OSG_FIND_LIBRARY(OSGSHADOW osgShadow)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGSHADOW DEFAULT_MSG
+    OSGSHADOW_LIBRARY OSGSHADOW_INCLUDE_DIR)

+ 13 - 45
Modules/FindosgSim.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osgSim
 # This module defines
-# OSGSIM_LIBRARY
-# OSGSIM_FOUND, if false, do not try to link to osgSim
-# OSGSIM_INCLUDE_DIR, where to find the headers
+#
+# OSGSIM_FOUND - Was osgSim found?
+# OSGSIM_INCLUDE_DIR - Where to find the headers
+# OSGSIM_LIBRARIES - The libraries to link for osgSim (use this)
+#
+# OSGSIM_LIBRARY - The osgSim library
+# OSGSIM_LIBRARY_DEBUG - The osgSim debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgSim/ImpostorSprite>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGSIM_INCLUDE_DIR osgSim/ImpostorSprite
-  HINTS
-  $ENV{OSGSIM_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGSIM_LIBRARY 
-  NAMES osgSim
-  HINTS
-  $ENV{OSGSIM_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGSIM_FOUND "NO")
-IF(OSGSIM_LIBRARY AND OSGSIM_INCLUDE_DIR)
-  SET(OSGSIM_FOUND "YES")
-ENDIF(OSGSIM_LIBRARY AND OSGSIM_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGSIM osgSim/ImpostorSprite)
+OSG_FIND_LIBRARY(OSGSIM osgSim)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGSIM DEFAULT_MSG
+    OSGSIM_LIBRARY OSGSIM_INCLUDE_DIR)

+ 13 - 45
Modules/FindosgTerrain.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osgTerrain
 # This module defines
-# OSGTERRAIN_LIBRARY
-# OSGTERRAIN_FOUND, if false, do not try to link to osgTerrain
-# OSGTERRAIN_INCLUDE_DIR, where to find the headers
+#
+# OSGTERRAIN_FOUND - Was osgTerrain found?
+# OSGTERRAIN_INCLUDE_DIR - Where to find the headers
+# OSGTERRAIN_LIBRARIES - The libraries to link for osgTerrain (use this)
+#
+# OSGTERRAIN_LIBRARY - The osgTerrain library
+# OSGTERRAIN_LIBRARY_DEBUG - The osgTerrain debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgTerrain/Terrain>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGTERRAIN_INCLUDE_DIR osgTerrain/Terrain
-  HINTS
-  $ENV{OSGTERRAIN_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGTERRAIN_LIBRARY 
-  NAMES osgTerrain
-  HINTS
-  $ENV{OSGTERRAIN_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGTERRAIN_FOUND "NO")
-IF(OSGTERRAIN_LIBRARY AND OSGTERRAIN_INCLUDE_DIR)
-  SET(OSGTERRAIN_FOUND "YES")
-ENDIF(OSGTERRAIN_LIBRARY AND OSGTERRAIN_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGTERRAIN osgTerrain/Terrain)
+OSG_FIND_LIBRARY(OSGTERRAIN osgTerrain)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGTERRAIN DEFAULT_MSG
+    OSGTERRAIN_LIBRARY OSGTERRAIN_INCLUDE_DIR)

+ 13 - 45
Modules/FindosgText.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osgText
 # This module defines
-# OSGTEXT_LIBRARY
-# OSGTEXT_FOUND, if false, do not try to link to osgText
-# OSGTEXT_INCLUDE_DIR, where to find the headers
+#
+# OSGTEXT_FOUND - Was osgText found?
+# OSGTEXT_INCLUDE_DIR - Where to find the headers
+# OSGTEXT_LIBRARIES - The libraries to link for osgText (use this)
+#
+# OSGTEXT_LIBRARY - The osgText library
+# OSGTEXT_LIBRARY_DEBUG - The osgText debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgText/Text>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGTEXT_INCLUDE_DIR osgText/Text
-  HINTS
-  $ENV{OSGTEXT_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGTEXT_LIBRARY 
-  NAMES osgText
-  HINTS
-  $ENV{OSGTEXT_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGTEXT_FOUND "NO")
-IF(OSGTEXT_LIBRARY AND OSGTEXT_INCLUDE_DIR)
-  SET(OSGTEXT_FOUND "YES")
-ENDIF(OSGTEXT_LIBRARY AND OSGTEXT_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGTEXT osgText/Text)
+OSG_FIND_LIBRARY(OSGTEXT osgText)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGTEXT DEFAULT_MSG
+    OSGTEXT_LIBRARY OSGTEXT_INCLUDE_DIR)

+ 13 - 45
Modules/FindosgUtil.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osgUtil
 # This module defines
-# OSGUTIL_LIBRARY
-# OSGUTIL_FOUND, if false, do not try to link to osgUtil
-# OSGUTIL_INCLUDE_DIR, where to find the headers
+#
+# OSGUTIL_FOUND - Was osgUtil found?
+# OSGUTIL_INCLUDE_DIR - Where to find the headers
+# OSGUTIL_LIBRARIES - The libraries to link for osgUtil (use this)
+#
+# OSGUTIL_LIBRARY - The osgUtil library
+# OSGUTIL_LIBRARY_DEBUG - The osgUtil debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgUtil/SceneView>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGUTIL_INCLUDE_DIR osgUtil/SceneView
-  HINTS
-  $ENV{OSGUTIL_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGUTIL_LIBRARY 
-  NAMES osgUtil
-  HINTS
-  $ENV{OSGUTIL_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGUTIL_FOUND "NO")
-IF(OSGUTIL_LIBRARY AND OSGUTIL_INCLUDE_DIR)
-  SET(OSGUTIL_FOUND "YES")
-ENDIF(OSGUTIL_LIBRARY AND OSGUTIL_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGUTIL osgUtil/SceneView)
+OSG_FIND_LIBRARY(OSGUTIL osgUtil)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGUTIL DEFAULT_MSG
+    OSGUTIL_LIBRARY OSGUTIL_INCLUDE_DIR)

+ 13 - 45
Modules/FindosgViewer.cmake

@@ -11,9 +11,13 @@
 # 
 # Locate osgViewer
 # This module defines
-# OSGVIEWER_LIBRARY
-# OSGVIEWER_FOUND, if false, do not try to link to osgViewer
-# OSGVIEWER_INCLUDE_DIR, where to find the headers
+#
+# OSGVIEWER_FOUND - Was osgViewer found?
+# OSGVIEWER_INCLUDE_DIR - Where to find the headers
+# OSGVIEWER_LIBRARIES - The libraries to link for osgViewer (use this)
+#
+# OSGVIEWER_LIBRARY - The osgViewer library
+# OSGVIEWER_LIBRARY_DEBUG - The osgViewer debug library
 #
 # $OSGDIR is an environment variable that would
 # correspond to the ./configure --prefix=$OSGDIR
@@ -25,46 +29,10 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgViewer/Viewer>
 
-# Try the user's environment request before anything else.
-FIND_PATH(OSGVIEWER_INCLUDE_DIR osgViewer/Viewer
-  HINTS
-  $ENV{OSGVIEWER_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES include
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw # Fink
-    /opt/local # DarwinPorts
-    /opt/csw # Blastwave
-    /opt
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
-    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
-)
-
-FIND_LIBRARY(OSGVIEWER_LIBRARY 
-  NAMES osgViewer
-  HINTS
-  $ENV{OSGVIEWER_DIR}
-  $ENV{OSG_DIR}
-  $ENV{OSGDIR}
-  PATH_SUFFIXES lib64 lib
-  PATHS
-    ~/Library/Frameworks
-    /Library/Frameworks
-  /usr/local
-  /usr
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
-)
-
-SET(OSGVIEWER_FOUND "NO")
-IF(OSGVIEWER_LIBRARY AND OSGVIEWER_INCLUDE_DIR)
-  SET(OSGVIEWER_FOUND "YES")
-ENDIF(OSGVIEWER_LIBRARY AND OSGVIEWER_INCLUDE_DIR)
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGVIEWER osgViewer/Viewer)
+OSG_FIND_LIBRARY(OSGVIEWER osgViewer)
 
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGVIEWER DEFAULT_MSG
+    OSGVIEWER_LIBRARY OSGVIEWER_INCLUDE_DIR)

+ 38 - 0
Modules/FindosgVolume.cmake

@@ -0,0 +1,38 @@
+# This is part of the Findosg* suite used to find OpenSceneGraph components.
+# Each component is separate and you must opt in to each module. You must 
+# also opt into OpenGL and OpenThreads (and Producer if needed) as these 
+# modules won't do it for you. This is to allow you control over your own 
+# system piece by piece in case you need to opt out of certain components
+# or change the Find behavior for a particular module (perhaps because the
+# default FindOpenGL.cmake module doesn't work with your system as an
+# example).
+# If you want to use a more convenient module that includes everything,
+# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+# 
+# Locate osgVolume
+# This module defines
+#
+# OSGVOLUME_FOUND - Was osgVolume found?
+# OSGVOLUME_INCLUDE_DIR - Where to find the headers
+# OSGVOLUME_LIBRARIES - The libraries to link for osgVolume (use this)
+#
+# OSGVOLUME_LIBRARY - The osgVolume library
+# OSGVOLUME_LIBRARY_DEBUG - The osgVolume debug library
+#
+# $OSGDIR is an environment variable that would
+# correspond to the ./configure --prefix=$OSGDIR
+# used in building osg.
+#
+# Created by Eric Wing.
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgVolume/Volume>
+
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGVOLUME osgVolume/Volume)
+OSG_FIND_LIBRARY(OSGVOLUME osgVolume)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGVOLUME DEFAULT_MSG
+    OSGVOLUME_LIBRARY OSGVOLUME_INCLUDE_DIR)

+ 38 - 0
Modules/FindosgWidget.cmake

@@ -0,0 +1,38 @@
+# This is part of the Findosg* suite used to find OpenSceneGraph components.
+# Each component is separate and you must opt in to each module. You must 
+# also opt into OpenGL and OpenThreads (and Producer if needed) as these 
+# modules won't do it for you. This is to allow you control over your own 
+# system piece by piece in case you need to opt out of certain components
+# or change the Find behavior for a particular module (perhaps because the
+# default FindOpenGL.cmake module doesn't work with your system as an
+# example).
+# If you want to use a more convenient module that includes everything,
+# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+# 
+# Locate osgWidget
+# This module defines
+#
+# OSGWIDGET_FOUND - Was osgWidget found?
+# OSGWIDGET_INCLUDE_DIR - Where to find the headers
+# OSGWIDGET_LIBRARIES - The libraries to link for osgWidget (use this)
+#
+# OSGWIDGET_LIBRARY - The osgWidget library
+# OSGWIDGET_LIBRARY_DEBUG - The osgWidget debug library
+#
+# $OSGDIR is an environment variable that would
+# correspond to the ./configure --prefix=$OSGDIR
+# used in building osg.
+#
+# FindosgWidget.cmake tweaked from Findosg* suite as created by Eric Wing.
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgWidget/Widget>
+
+include(Findosg_functions)
+OSG_FIND_PATH   (OSGWIDGET osgWidget/Widget)
+OSG_FIND_LIBRARY(OSGWIDGET osgWidget)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSGWIDGET DEFAULT_MSG
+    OSGWIDGET_LIBRARY OSGWIDGET_INCLUDE_DIR)

+ 90 - 0
Modules/Findosg_functions.cmake

@@ -0,0 +1,90 @@
+#
+# This CMake file contains two macros to assist with searching for OSG
+# libraries and nodekits.
+#
+
+#
+# OSG_FIND_PATH
+#
+function(OSG_FIND_PATH module header)
+   string(TOUPPER ${module} module_uc)
+
+   # Try the user's environment request before anything else.
+   find_path(${module_uc}_INCLUDE_DIR ${header}
+       HINTS
+            $ENV{${module_uc}_DIR}
+            $ENV{OSG_DIR}
+            $ENV{OSGDIR}
+       PATH_SUFFIXES include
+       PATHS
+            ~/Library/Frameworks
+            /Library/Frameworks
+            /sw # Fink
+            /opt/local # DarwinPorts
+            /opt/csw # Blastwave
+            /opt
+            [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
+            [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
+   )
+endfunction(OSG_FIND_PATH module header)
+
+
+#
+# OSG_FIND_LIBRARY
+#
+function(OSG_FIND_LIBRARY module library)
+   string(TOUPPER ${module} module_uc)
+
+   find_library(${module_uc}_LIBRARY
+       NAMES ${library}
+       HINTS
+            $ENV{${module_uc}_DIR}
+            $ENV{OSG_DIR}
+            $ENV{OSGDIR}
+       PATH_SUFFIXES lib64 lib
+       PATHS
+            ~/Library/Frameworks
+            /Library/Frameworks
+            /usr/local
+            /usr
+            /sw # Fink
+            /opt/local # DarwinPorts
+            /opt/csw # Blastwave
+            /opt
+            [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
+   )
+
+   find_library(${module_uc}_LIBRARY_DEBUG
+       NAMES ${library}d
+       HINTS
+            $ENV{${module_uc}_DIR}
+            $ENV{OSG_DIR}
+            $ENV{OSGDIR}
+       PATH_SUFFIXES lib64 lib
+       PATHS
+            ~/Library/Frameworks
+            /Library/Frameworks
+            /usr/local
+            /usr
+            /sw # Fink
+            /opt/local # DarwinPorts
+            /opt/csw # Blastwave
+            /opt
+            [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
+    )
+
+   if(NOT ${module_uc}_LIBRARY_DEBUG)
+      # They don't have a debug library
+      set(${module_uc}_LIBRARY_DEBUG ${${module_uc}_LIBRARY} PARENT_SCOPE)
+      set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARY} PARENT_SCOPE)
+   else()
+      # They really have a FOO_LIBRARY_DEBUG
+      set(${module_uc}_LIBRARIES 
+          optimized ${${module_uc}_LIBRARY}
+          debug ${${module_uc}_LIBRARY_DEBUG}
+          PARENT_SCOPE
+      )
+   endif()
+
+
+endfunction(OSG_FIND_LIBRARY module library)