Findosg_functions.cmake 2.9 KB

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