1# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2# file Copyright.txt or https://cmake.org/licensing for details.
3
4#[=======================================================================[.rst:
5Findosg_functions
6-----------------
7
8
9
10
11
12This CMake file contains two macros to assist with searching for OSG
13libraries and nodekits.  Please see FindOpenSceneGraph.cmake for full
14documentation.
15#]=======================================================================]
16
17include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
18
19#
20# OSG_FIND_PATH
21#
22function(OSG_FIND_PATH module header)
23  string(TOUPPER ${module} module_uc)
24
25  # Try the user's environment request before anything else.
26  find_path(${module_uc}_INCLUDE_DIR ${header}
27    HINTS
28      ENV ${module_uc}_DIR
29      ENV OSG_DIR
30      ENV OSGDIR
31      ENV OSG_ROOT
32      ${${module_uc}_DIR}
33      ${OSG_DIR}
34    PATH_SUFFIXES include
35  )
36endfunction()
37
38
39#
40# OSG_FIND_LIBRARY
41#
42function(OSG_FIND_LIBRARY module library)
43  string(TOUPPER ${module} module_uc)
44
45  find_library(${module_uc}_LIBRARY_RELEASE
46    NAMES ${library}
47    HINTS
48      ENV ${module_uc}_DIR
49      ENV OSG_DIR
50      ENV OSGDIR
51      ENV OSG_ROOT
52      ${${module_uc}_DIR}
53      ${OSG_DIR}
54    PATH_SUFFIXES lib
55  )
56
57  find_library(${module_uc}_LIBRARY_DEBUG
58    NAMES ${library}d
59    HINTS
60      ENV ${module_uc}_DIR
61      ENV OSG_DIR
62      ENV OSGDIR
63      ENV OSG_ROOT
64      ${${module_uc}_DIR}
65      ${OSG_DIR}
66    PATH_SUFFIXES lib
67  )
68
69  select_library_configurations(${module_uc})
70
71  # the variables set by select_library_configurations go out of scope
72  # here, so we need to set them again
73  set(${module_uc}_LIBRARY ${${module_uc}_LIBRARY} PARENT_SCOPE)
74  set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARIES} PARENT_SCOPE)
75endfunction()
76
77#
78# OSG_MARK_AS_ADVANCED
79# Just a convenience function for calling MARK_AS_ADVANCED
80#
81function(OSG_MARK_AS_ADVANCED _module)
82  string(TOUPPER ${_module} _module_UC)
83  mark_as_advanced(${_module_UC}_INCLUDE_DIR)
84  mark_as_advanced(${_module_UC}_LIBRARY)
85  mark_as_advanced(${_module_UC}_LIBRARY_DEBUG)
86endfunction()
87