1# - Use some smarts to try to find OpenSceneGraph in the Program Files dirs 2# 3# Also uses the OSGHOME environment variable as OSG_DIR, if it's found. 4# 5# Usage: 6# include(SearchProgramFilesForOpenSceneGraph OPTIONAL) 7# 8# Requires these CMake modules: 9# ListFilter 10# ProgramFilesGlob 11# 12# Original Author: 13# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> 14# http://academic.cleardefinition.com 15# Iowa State University HCI Graduate Program/VRAC 16# 17# Copyright Iowa State University 2009-2010. 18# Distributed under the Boost Software License, Version 1.0. 19# (See accompanying file LICENSE_1_0.txt or copy at 20# http://www.boost.org/LICENSE_1_0.txt) 21 22include(ListFilter) 23include(ProgramFilesGlob) 24include(CleanDirectoryList) 25 26# Try to find an OSG installation 27set(_osgpaths) 28if(WIN32) 29 program_files_glob(_osgpaths "/OpenSceneGraph*") 30 if(_osgpaths) 31 if(MSVC80) 32 list_filter_out(_osgpaths "[vV][cC]9" ${_osgpaths}) 33 elseif(MSVC90) 34 list_filter_out(_osgpaths "[vV][cC]8" ${_osgpaths}) 35 endif() 36 if(_osgpaths) 37 list(SORT _osgpaths) 38 list(REVERSE _osgpaths) 39 endif() 40 endif() 41else() 42 prefix_list_glob(_osgpaths "/OpenSceneGraph*" /usr /usr/local /opt) 43 if(_osgpaths) 44 clean_directory_list(_osgpaths) 45 if(_osgpaths) 46 list(SORT _osgpaths) 47 list(REVERSE _osgpaths) 48 endif() 49 endif() 50endif() 51 52 53if(_osgpaths) 54 # Want them in reverse order so newer versions come up first 55 list(SORT _osgpaths) 56 list(REVERSE _osgpaths) 57 58 # Use the environment variable to override 59 set(_osgpaths "$ENV{OSGHOME}" ${_osgpaths}) 60 clean_directory_list(_osgpaths) 61 62 list(APPEND CMAKE_PREFIX_PATH ${_osgpaths}) 63endif() 64 65# Not completely related 66set(OpenSceneGraph_MARK_AS_ADVANCED TRUE) 67