File: SearchProgramFilesForOpenSceneGraph.cmake

package info (click to toggle)
freespace2 24.0.2%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 43,188 kB
  • sloc: cpp: 583,107; ansic: 21,729; python: 1,174; sh: 464; makefile: 248; xml: 181
file content (66 lines) | stat: -rw-r--r-- 1,686 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# - Use some smarts to try to find OpenSceneGraph in the Program Files dirs
#
# Also uses the OSGHOME environment variable as OSG_DIR, if it's found.
#
# Usage:
#  include(SearchProgramFilesForOpenSceneGraph OPTIONAL)
#
# Requires these CMake modules:
#  ListFilter
#  ProgramFilesGlob
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

include(ListFilter)
include(ProgramFilesGlob)
include(CleanDirectoryList)

# Try to find an OSG installation
set(_osgpaths)
if(WIN32)
	program_files_glob(_osgpaths "/OpenSceneGraph*")
	if(_osgpaths)
		if(MSVC80)
			list_filter_out(_osgpaths "[vV][cC]9" ${_osgpaths})
		elseif(MSVC90)
			list_filter_out(_osgpaths "[vV][cC]8" ${_osgpaths})
		endif()
		if(_osgpaths)
			list(SORT _osgpaths)
			list(REVERSE _osgpaths)
		endif()
	endif()
else()
	prefix_list_glob(_osgpaths "/OpenSceneGraph*" /usr /usr/local /opt)
	if(_osgpaths)
		clean_directory_list(_osgpaths)
		if(_osgpaths)
			list(SORT _osgpaths)
			list(REVERSE _osgpaths)
		endif()
	endif()
endif()


if(_osgpaths)
	# Want them in reverse order so newer versions come up first
	list(SORT _osgpaths)
	list(REVERSE _osgpaths)

	# Use the environment variable to override
	set(_osgpaths "$ENV{OSGHOME}" ${_osgpaths})
	clean_directory_list(_osgpaths)

	list(APPEND CMAKE_PREFIX_PATH ${_osgpaths})
endif()

# Not completely related
set(OpenSceneGraph_MARK_AS_ADVANCED TRUE)