Findosg_functions.cmake 2.5 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. PATH_SUFFIXES include
  17. PATHS
  18. ~/Library/Frameworks
  19. /Library/Frameworks
  20. /sw # Fink
  21. /opt/local # DarwinPorts
  22. /opt/csw # Blastwave
  23. /opt
  24. [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
  25. [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
  26. )
  27. endfunction(OSG_FIND_PATH module header)
  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
  34. NAMES ${library}
  35. HINTS
  36. $ENV{${module_uc}_DIR}
  37. $ENV{OSG_DIR}
  38. $ENV{OSGDIR}
  39. PATH_SUFFIXES lib64 lib
  40. PATHS
  41. ~/Library/Frameworks
  42. /Library/Frameworks
  43. /usr/local
  44. /usr
  45. /sw # Fink
  46. /opt/local # DarwinPorts
  47. /opt/csw # Blastwave
  48. /opt
  49. [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
  50. )
  51. find_library(${module_uc}_LIBRARY_DEBUG
  52. NAMES ${library}d
  53. HINTS
  54. $ENV{${module_uc}_DIR}
  55. $ENV{OSG_DIR}
  56. $ENV{OSGDIR}
  57. PATH_SUFFIXES lib64 lib
  58. PATHS
  59. ~/Library/Frameworks
  60. /Library/Frameworks
  61. /usr/local
  62. /usr
  63. /sw # Fink
  64. /opt/local # DarwinPorts
  65. /opt/csw # Blastwave
  66. /opt
  67. [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
  68. )
  69. if(NOT ${module_uc}_LIBRARY_DEBUG)
  70. # They don't have a debug library
  71. set(${module_uc}_LIBRARY_DEBUG ${${module_uc}_LIBRARY} PARENT_SCOPE)
  72. set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARY} PARENT_SCOPE)
  73. else()
  74. # They really have a FOO_LIBRARY_DEBUG
  75. set(${module_uc}_LIBRARIES
  76. optimized ${${module_uc}_LIBRARY}
  77. debug ${${module_uc}_LIBRARY_DEBUG}
  78. PARENT_SCOPE
  79. )
  80. endif()
  81. endfunction(OSG_FIND_LIBRARY module library)