Findosg_functions.cmake 2.2 KB

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