Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Modules / Findosg_functions.cmake
blob128be376f436a15cecac40ac00967b651a8aae40
2 # This CMake file contains two macros to assist with searching for OSG
3 # libraries and nodekits.
7 # OSG_FIND_PATH
9 function(OSG_FIND_PATH module header)
10    string(TOUPPER ${module} module_uc)
12    # Try the user's environment request before anything else.
13    find_path(${module_uc}_INCLUDE_DIR ${header}
14        HINTS
15             $ENV{${module_uc}_DIR}
16             $ENV{OSG_DIR}
17             $ENV{OSGDIR}
18             $ENV{OSG_ROOT}
19        PATH_SUFFIXES include
20        PATHS
21             /sw # Fink
22             /opt/local # DarwinPorts
23             /opt/csw # Blastwave
24             /opt
25             /usr/freeware
26    )
27 endfunction(OSG_FIND_PATH module header)
31 # OSG_FIND_LIBRARY
33 function(OSG_FIND_LIBRARY module library)
34    string(TOUPPER ${module} module_uc)
36    find_library(${module_uc}_LIBRARY
37        NAMES ${library}
38        HINTS
39             $ENV{${module_uc}_DIR}
40             $ENV{OSG_DIR}
41             $ENV{OSGDIR}
42             $ENV{OSG_ROOT}
43        PATH_SUFFIXES lib64 lib
44        PATHS
45             /sw # Fink
46             /opt/local # DarwinPorts
47             /opt/csw # Blastwave
48             /opt
49             /usr/freeware
50    )
52    find_library(${module_uc}_LIBRARY_DEBUG
53        NAMES ${library}d
54        HINTS
55             $ENV{${module_uc}_DIR}
56             $ENV{OSG_DIR}
57             $ENV{OSGDIR}
58             $ENV{OSG_ROOT}
59        PATH_SUFFIXES lib64 lib
60        PATHS
61             /sw # Fink
62             /opt/local # DarwinPorts
63             /opt/csw # Blastwave
64             /opt
65             /usr/freeware
66     )
68    if(NOT ${module_uc}_LIBRARY_DEBUG)
69       # They don't have a debug library
70       set(${module_uc}_LIBRARY_DEBUG ${${module_uc}_LIBRARY} PARENT_SCOPE)
71       set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARY} PARENT_SCOPE)
72    else()
73       # They really have a FOO_LIBRARY_DEBUG
74       set(${module_uc}_LIBRARIES 
75           optimized ${${module_uc}_LIBRARY}
76           debug ${${module_uc}_LIBRARY_DEBUG}
77           PARENT_SCOPE
78       )
79    endif()
80 endfunction(OSG_FIND_LIBRARY module library)
83 # OSG_MARK_AS_ADVANCED
84 # Just a convenience function for calling MARK_AS_ADVANCED
86 function(OSG_MARK_AS_ADVANCED _module)
87    string(TOUPPER ${_module} _module_UC)
88    mark_as_advanced(${_module_UC}_INCLUDE_DIR)
89    mark_as_advanced(${_module_UC}_LIBRARY)
90    mark_as_advanced(${_module_UC}_LIBRARY_DEBUG)
91 endfunction()