Findosg_functions.cmake 2.1 KB

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