Findosg_functions.cmake 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. #
  7. #
  8. #
  9. #
  10. #
  11. # This CMake file contains two macros to assist with searching for OSG
  12. # libraries and nodekits. Please see FindOpenSceneGraph.cmake for full
  13. # documentation.
  14. #
  15. # OSG_FIND_PATH
  16. #
  17. function(OSG_FIND_PATH module header)
  18. string(TOUPPER ${module} module_uc)
  19. # Try the user's environment request before anything else.
  20. find_path(${module_uc}_INCLUDE_DIR ${header}
  21. HINTS
  22. ENV ${module_uc}_DIR
  23. ENV OSG_DIR
  24. ENV OSGDIR
  25. ENV OSG_ROOT
  26. ${${module_uc}_DIR}
  27. ${OSG_DIR}
  28. PATH_SUFFIXES include
  29. )
  30. endfunction()
  31. #
  32. # OSG_FIND_LIBRARY
  33. #
  34. function(OSG_FIND_LIBRARY module library)
  35. 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. ${${module_uc}_DIR}
  44. ${OSG_DIR}
  45. PATH_SUFFIXES lib
  46. )
  47. find_library(${module_uc}_LIBRARY_DEBUG
  48. NAMES ${library}d
  49. HINTS
  50. ENV ${module_uc}_DIR
  51. ENV OSG_DIR
  52. ENV OSGDIR
  53. ENV OSG_ROOT
  54. ${${module_uc}_DIR}
  55. ${OSG_DIR}
  56. PATH_SUFFIXES lib
  57. )
  58. if(NOT ${module_uc}_LIBRARY_DEBUG)
  59. # They don't have a debug library
  60. set(${module_uc}_LIBRARY_DEBUG ${${module_uc}_LIBRARY} PARENT_SCOPE)
  61. set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARY} PARENT_SCOPE)
  62. else()
  63. # They really have a FOO_LIBRARY_DEBUG
  64. set(${module_uc}_LIBRARIES
  65. optimized ${${module_uc}_LIBRARY}
  66. debug ${${module_uc}_LIBRARY_DEBUG}
  67. PARENT_SCOPE
  68. )
  69. endif()
  70. endfunction()
  71. #
  72. # OSG_MARK_AS_ADVANCED
  73. # Just a convenience function for calling MARK_AS_ADVANCED
  74. #
  75. function(OSG_MARK_AS_ADVANCED _module)
  76. string(TOUPPER ${_module} _module_UC)
  77. mark_as_advanced(${_module_UC}_INCLUDE_DIR)
  78. mark_as_advanced(${_module_UC}_LIBRARY)
  79. mark_as_advanced(${_module_UC}_LIBRARY_DEBUG)
  80. endfunction()