FindFLTK.cmake 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. INCLUDE(${CMAKE_ROOT}/Modules/FindX11.cmake)
  41. SET( FLTK_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} -lm)
  42. ENDIF(UNIX)
  43. IF(APPLE)
  44. SET( FLTK_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz")
  45. ENDIF(APPLE)
  46. # Make sure that the FLTK include path has been set
  47. # So the FLTK_LIBRARY does not appear the first time
  48. IF(FLTK_INCLUDE_DIR)
  49. IF(FLTK_VERSION_1.0.11)
  50. FIND_LIBRARY(FLTK_BASE_LIBRARY NAMES fltk fltkd
  51. PATHS /usr/lib /usr/local/lib
  52. /usr/local/fltk/lib
  53. /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib
  54. )
  55. ENDIF(FLTK_VERSION_1.0.11)
  56. IF(FLTK_VERSION_1.1)
  57. FIND_LIBRARY(FLTK_BASE_LIBRARY NAMES fltk fltkd
  58. PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib
  59. /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib
  60. )
  61. FIND_LIBRARY(FLTK_GL_LIBRARY NAMES fltkgl fltkgld fltk_gl
  62. PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib
  63. /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib
  64. )
  65. FIND_LIBRARY(FLTK_FORMS_LIBRARY NAMES fltkforms fltkformsd fltk_forms
  66. PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib
  67. /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib
  68. )
  69. FIND_LIBRARY(FLTK_IMAGES_LIBRARY NAMES fltkimages fltkimagesd fltk_images
  70. PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib
  71. /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib
  72. )
  73. ENDIF(FLTK_VERSION_1.1)
  74. SET( FLTK_LIBRARIES ${FLTK_BASE_LIBRARY} ${FLTK_GL_LIBRARY}
  75. ${FLTK_FORMS_LIBRARY} ${FLTK_IMAGES_LIBRARY} ${FLTK_PLATFORM_DEPENDENT_LIBS}
  76. )
  77. ENDIF(FLTK_INCLUDE_DIR)
  78. # Find Fluid
  79. FIND_PROGRAM(FLTK_FLUID_EXECUTABLE fluid
  80. ${path} ${FLTK_INCLUDE_DIR}/fluid
  81. )
  82. # Enable the Wrap UI command
  83. IF (FLTK_FLUID_EXECUTABLE)
  84. SET ( FLTK_WRAP_UI 1 CACHE INTERNAL "Can we honour the FLTK_WRAP_UI command" )
  85. ENDIF (FLTK_FLUID_EXECUTABLE)
  86. #
  87. # Set FLTK_FOUND
  88. # This is the final flag that will be checked by
  89. # other code that requires FLTK for compile/run.
  90. #
  91. IF(FLTK_FLUID_EXECUTABLE)
  92. IF(FLTK_INCLUDE_DIR)
  93. IF(FLTK_LIBRARIES)
  94. # The fact that it is in the cache is deprecated.
  95. SET (FLTK_FOUND 1 CACHE INTERNAL "FLTK library, headers and Fluid are available")
  96. # The following deprecated settings are for compatibility with CMake 1.4
  97. SET (HAS_FLTK ${FLTK_FOUND})
  98. SET (FLTK_INCLUDE_PATH ${FLTK_INCLUDE_DIR})
  99. SET (FLTK_FLUID_EXE ${FLTK_FLUID_EXECUTABLE})
  100. SET (FLTK_LIBRARY ${FLTK_LIBRARIES})
  101. ENDIF(FLTK_LIBRARIES)
  102. ENDIF(FLTK_INCLUDE_DIR)
  103. ENDIF(FLTK_FLUID_EXECUTABLE)
  104. MARK_AS_ADVANCED(
  105. FLTK_VERSION_1.0.11
  106. FLTK_VERSION_1.1
  107. )