Findosg_functions.cmake 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #
  2. # This CMake file contains two macros to assist with searching for OSG
  3. # libraries and nodekits. Please see FindOpenSceneGraph.cmake for full
  4. # documentation.
  5. #
  6. #=============================================================================
  7. # Copyright 2009 Kitware, Inc.
  8. # Copyright 2009-2012 Philip Lowman <[email protected]>
  9. #
  10. # Distributed under the OSI-approved BSD License (the "License");
  11. # see accompanying file Copyright.txt for details.
  12. #
  13. # This software is distributed WITHOUT ANY WARRANTY; without even the
  14. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. # See the License for more information.
  16. #=============================================================================
  17. # (To distribute this file outside of CMake, substitute the full
  18. # License text for the above reference.)
  19. #
  20. # OSG_FIND_PATH
  21. #
  22. function(OSG_FIND_PATH module header)
  23. string(TOUPPER ${module} module_uc)
  24. # Try the user's environment request before anything else.
  25. find_path(${module_uc}_INCLUDE_DIR ${header}
  26. HINTS
  27. $ENV{${module_uc}_DIR}
  28. $ENV{OSG_DIR}
  29. $ENV{OSGDIR}
  30. $ENV{OSG_ROOT}
  31. ${${module_uc}_DIR}
  32. ${OSG_DIR}
  33. PATH_SUFFIXES include
  34. PATHS
  35. /sw # Fink
  36. /opt/local # DarwinPorts
  37. /opt/csw # Blastwave
  38. /opt
  39. /usr/freeware
  40. )
  41. endfunction()
  42. #
  43. # OSG_FIND_LIBRARY
  44. #
  45. function(OSG_FIND_LIBRARY module library)
  46. string(TOUPPER ${module} module_uc)
  47. find_library(${module_uc}_LIBRARY
  48. NAMES ${library}
  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 lib64 lib
  57. PATHS
  58. /sw # Fink
  59. /opt/local # DarwinPorts
  60. /opt/csw # Blastwave
  61. /opt
  62. /usr/freeware
  63. )
  64. find_library(${module_uc}_LIBRARY_DEBUG
  65. NAMES ${library}d
  66. HINTS
  67. $ENV{${module_uc}_DIR}
  68. $ENV{OSG_DIR}
  69. $ENV{OSGDIR}
  70. $ENV{OSG_ROOT}
  71. ${${module_uc}_DIR}
  72. ${OSG_DIR}
  73. PATH_SUFFIXES lib64 lib
  74. PATHS
  75. /sw # Fink
  76. /opt/local # DarwinPorts
  77. /opt/csw # Blastwave
  78. /opt
  79. /usr/freeware
  80. )
  81. if(NOT ${module_uc}_LIBRARY_DEBUG)
  82. # They don't have a debug library
  83. set(${module_uc}_LIBRARY_DEBUG ${${module_uc}_LIBRARY} PARENT_SCOPE)
  84. set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARY} PARENT_SCOPE)
  85. else()
  86. # They really have a FOO_LIBRARY_DEBUG
  87. set(${module_uc}_LIBRARIES
  88. optimized ${${module_uc}_LIBRARY}
  89. debug ${${module_uc}_LIBRARY_DEBUG}
  90. PARENT_SCOPE
  91. )
  92. endif()
  93. endfunction()
  94. #
  95. # OSG_MARK_AS_ADVANCED
  96. # Just a convenience function for calling MARK_AS_ADVANCED
  97. #
  98. function(OSG_MARK_AS_ADVANCED _module)
  99. string(TOUPPER ${_module} _module_UC)
  100. mark_as_advanced(${_module_UC}_INCLUDE_DIR)
  101. mark_as_advanced(${_module_UC}_LIBRARY)
  102. mark_as_advanced(${_module_UC}_LIBRARY_DEBUG)
  103. endfunction()