FindFLTK.cmake 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #
  2. # Find the native FLTK includes and library
  3. #
  4. # The following settings are defined
  5. # FLTK_FLUID_EXECUTABLE, where to find the Fluid tool
  6. # FLTK_WRAP_UI, This allows the FLTK_WRAP_UI command to work.
  7. # FLTK_INCLUDE_DIR, where to find include files
  8. # FLTK_LIBRARIES, list of fltk libraries
  9. # FLTK_VERSION_1.0.11 Use this Version
  10. # FLTK_VERSION_1.1 Use this Version
  11. # FLTK_FOUND, Don't use FLTK if false.
  12. # The following settings should not be used in general.
  13. # FLTK_BASE_LIBRARY = the full path to fltk.lib
  14. # FLTK_GL_LIBRARY = the full path to fltk_gl.lib
  15. # FLTK_FORMS_LIBRARY = the full path to fltk_forms.lib
  16. # FLTK_IMAGES_LIBRARY = the full path to fltk_images.lib
  17. OPTION(FLTK_VERSION_1.1 "Use FLTK version 1.1" 1)
  18. OPTION(FLTK_VERSION_1.0.11 "Use FLTK version 1.0.11" 0)
  19. # Exclusion between the two version
  20. IF(FLTK_VERSION_1.1)
  21. SET(FLTK_VERSION_1.0.11 0)
  22. ENDIF(FLTK_VERSION_1.1)
  23. FIND_PATH(FLTK_INCLUDE_DIR FL/Fl.h
  24. /usr/local/include
  25. /usr/include
  26. /usr/local/fltk
  27. /usr/X11R6/include
  28. )
  29. # Platform dependent libraries required by FLTK
  30. IF(WIN32)
  31. IF(NOT CYGWIN)
  32. IF(BORLAND)
  33. SET( FLTK_PLATFORM_DEPENDENT_LIBS import32 )
  34. ELSE(BORLAND)
  35. SET( FLTK_PLATFORM_DEPENDENT_LIBS wsock32 comctl32 )
  36. ENDIF(BORLAND)
  37. ENDIF(NOT CYGWIN)
  38. ENDIF(WIN32)
  39. IF(UNIX)
  40. SET( FLTK_PLATFORM_DEPENDENT_LIBS ${CMAKE_X_LIBS} -lm)
  41. ENDIF(UNIX)
  42. IF(APPLE)
  43. SET( FLTK_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz")
  44. ENDIF(APPLE)
  45. # Make sure that the FLTK include path has been set
  46. # So the FLTK_LIBRARY does not appear the first time
  47. IF(FLTK_INCLUDE_DIR)
  48. IF(FLTK_VERSION_1.0.11)
  49. FIND_LIBRARY(FLTK_BASE_LIBRARY NAMES fltk fltkd
  50. PATHS /usr/lib /usr/local/lib
  51. /usr/local/fltk/lib
  52. /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib
  53. )
  54. ENDIF(FLTK_VERSION_1.0.11)
  55. IF(FLTK_VERSION_1.1)
  56. FIND_LIBRARY(FLTK_BASE_LIBRARY NAMES fltk fltkd
  57. PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib
  58. /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib
  59. )
  60. FIND_LIBRARY(FLTK_GL_LIBRARY NAMES fltkgl fltkgld fltk_gl
  61. PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib
  62. /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib
  63. )
  64. FIND_LIBRARY(FLTK_FORMS_LIBRARY NAMES fltkforms fltkformsd fltk_forms
  65. PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib
  66. /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib
  67. )
  68. FIND_LIBRARY(FLTK_IMAGES_LIBRARY NAMES fltkimages fltkimagesd fltk_images
  69. PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib
  70. /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib
  71. )
  72. ENDIF(FLTK_VERSION_1.1)
  73. SET( FLTK_LIBRARIES ${FLTK_BASE_LIBRARY} ${FLTK_GL_LIBRARY}
  74. ${FLTK_FORMS_LIBRARY} ${FLTK_IMAGES_LIBRARY} ${FLTK_PLATFORM_DEPENDENT_LIBS}
  75. )
  76. ENDIF(FLTK_INCLUDE_DIR)
  77. # Find Fluid
  78. FIND_FILE(FLTK_FLUID_EXECUTABLE fluid
  79. ${path} ${FLTK_INCLUDE_DIR}/fluid
  80. )
  81. # Enable the Wrap UI command
  82. IF (FLTK_FLUID_EXECUTABLE)
  83. SET ( FLTK_WRAP_UI 1 CACHE INTERNAL "Can we honour the FLTK_WRAP_UI command" )
  84. ENDIF (FLTK_FLUID_EXECUTABLE)
  85. #
  86. # Set FLTK_FOUND
  87. # This is the final flag that will be checked by
  88. # other code that requires FLTK for compile/run.
  89. #
  90. IF(FLTK_FLUID_EXECUTABLE)
  91. IF(FLTK_INCLUDE_DIR)
  92. IF(FLTK_LIBRARIES)
  93. # The fact that it is in the cache is deprecated.
  94. SET (FLTK_FOUND 1 CACHE INTERNAL "FLTK library, headers and Fluid are available")
  95. # The following deprecated settings are for compatibility with CMake 1.4
  96. SET (HAS_FLTK ${FLTK_FOUND})
  97. SET (FLTK_INCLUDE_PATH ${FLTK_INCLUDE_DIR})
  98. SET (FLTK_FLUID_EXE ${FLTK_FLUID_EXECUTABLE})
  99. SET (FLTK_LIBRARY ${FLTK_LIBRARIES})
  100. ENDIF(FLTK_LIBRARIES)
  101. ENDIF(FLTK_INCLUDE_DIR)
  102. ENDIF(FLTK_FLUID_EXECUTABLE)
  103. MARK_AS_ADVANCED(
  104. FLTK_VERSION_1.0.11
  105. FLTK_VERSION_1.1
  106. )