ENH: move EstimateFormatLength to kwsys
[cmake.git] / Modules / FindFLTK.cmake
blob8c83fe72da2e77574ca77dfaa67afd0d0fd81177
2 # Find the native FLTK includes and library
4 # The following settings are defined
5 # FLTK_FLUID_EXECUTABLE, where to find the Fluid tool
6 # FLTK_INCLUDE_DIR, where to find include files
7 # FLTK_LIBRARIES, list of fltk libraries
8 # FLTK_VERSION_1.0.11 Use this Version
9 # FLTK_VERSION_1.1 Use this Version
10 # FLTK_FOUND, Don't use FLTK if false.
12 # this is around for backwards compatibility 
13 # FLTK_WRAP_UI set to true if FLTK_FLUID_EXECUTABLE is found
17 # The following settings should not be used in general.
18 # FLTK_BASE_LIBRARY    = the full path to fltk.lib
19 # FLTK_GL_LIBRARY      = the full path to fltk_gl.lib
20 # FLTK_FORMS_LIBRARY   = the full path to fltk_forms.lib
21 # FLTK_IMAGES_LIBRARY  = the full path to fltk_images.lib
23 OPTION(FLTK_VERSION_1.1    "Use FLTK version 1.1"    1)
24 OPTION(FLTK_VERSION_1.0.11 "Use FLTK version 1.0.11" 0)
26 # Exclusion between the two version
28 IF(FLTK_VERSION_1.1)
29   SET(FLTK_VERSION_1.0.11 0)
30 ENDIF(FLTK_VERSION_1.1)
32 # look for both Fl.h and Fl.H
33 FIND_PATH(FLTK_INCLUDE_DIR FL/Fl.h
34   /usr/local/include
35   /usr/include
36   /usr/local/fltk
37   /usr/X11R6/include
40 FIND_PATH(FLTK_INCLUDE_DIR FL/Fl.H
41   /usr/local/include
42   /usr/include
43   /usr/local/fltk
44   /usr/X11R6/include
47 # Platform dependent libraries required by FLTK
49 IF(WIN32)
50   IF(NOT CYGWIN)
51     IF(BORLAND)
52       SET( FLTK_PLATFORM_DEPENDENT_LIBS import32 )
53     ELSE(BORLAND)
54       SET( FLTK_PLATFORM_DEPENDENT_LIBS wsock32 comctl32 )
55     ENDIF(BORLAND)
56   ENDIF(NOT CYGWIN)
57 ENDIF(WIN32)
59 IF(UNIX)
60   INCLUDE(FindX11)
61   SET( FLTK_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} -lm)
62 ENDIF(UNIX)
64 IF(APPLE)
65   SET( FLTK_PLATFORM_DEPENDENT_LIBS  "-framework Carbon -framework Cocoa -framework ApplicationServices -lz")
66 ENDIF(APPLE)
68 # Make sure that the FLTK include path has been set
69 # So the FLTK_LIBRARY does not appear the first time
70 IF(FLTK_INCLUDE_DIR)
71   IF(FLTK_VERSION_1.0.11)
72       FIND_LIBRARY(FLTK_BASE_LIBRARY  NAMES fltk fltkd
73            PATHS /usr/lib /usr/local/lib
74            /usr/local/lib/fltk
75            /usr/local/fltk/lib
76            /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib
77       )
78   ENDIF(FLTK_VERSION_1.0.11)
79   IF(FLTK_VERSION_1.1)
80     FIND_LIBRARY(FLTK_BASE_LIBRARY  NAMES fltk fltkd
81       PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib
82       /usr/X11R6/lib  ${FLTK_INCLUDE_DIR}/lib
83     )
84     FIND_LIBRARY(FLTK_GL_LIBRARY NAMES fltkgl fltkgld fltk_gl
85       PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib
86       /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib
87     )
88     FIND_LIBRARY(FLTK_FORMS_LIBRARY NAMES fltkforms fltkformsd fltk_forms
89       PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib
90       /usr/X11R6/lib  ${FLTK_INCLUDE_DIR}/lib
91     )
92     FIND_LIBRARY(FLTK_IMAGES_LIBRARY NAMES fltkimages fltkimagesd fltk_images
93       PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib
94       /usr/X11R6/lib  ${FLTK_INCLUDE_DIR}/lib
95     )
96   ENDIF(FLTK_VERSION_1.1)
97   SET( FLTK_LIBRARIES 
98     ${FLTK_GL_LIBRARY}
99     ${FLTK_FORMS_LIBRARY}
100     ${FLTK_IMAGES_LIBRARY}
101     ${FLTK_BASE_LIBRARY}
102     ${FLTK_PLATFORM_DEPENDENT_LIBS}
103   )
104 ENDIF(FLTK_INCLUDE_DIR)
105 # Find Fluid
106 FIND_PROGRAM(FLTK_FLUID_EXECUTABLE fluid
107   ${path} ${FLTK_INCLUDE_DIR}/fluid
111 #  Set FLTK_FOUND
112 #  This is the final flag that will be checked by
113 #  other code that requires FLTK for compile/run.
116 IF(FLTK_FLUID_EXECUTABLE)
117   IF(FLTK_INCLUDE_DIR)
118     IF(FLTK_LIBRARIES)
120       # The fact that it is in the cache is deprecated.
121       SET (FLTK_FOUND 1 CACHE INTERNAL "FLTK library, headers and Fluid are available")
123       # The following deprecated settings are for compatibility with CMake 1.4
124       SET (HAS_FLTK ${FLTK_FOUND})
125       SET (FLTK_INCLUDE_PATH ${FLTK_INCLUDE_DIR})
126       SET (FLTK_FLUID_EXE ${FLTK_FLUID_EXECUTABLE})
127       SET (FLTK_LIBRARY ${FLTK_LIBRARIES})
128     ENDIF(FLTK_LIBRARIES)
129   ENDIF(FLTK_INCLUDE_DIR)
130 ENDIF(FLTK_FLUID_EXECUTABLE)
133 IF (FLTK_FLUID_EXECUTABLE)   
134   SET ( FLTK_WRAP_UI 1 CACHE INTERNAL "Do we have the fluid executable" )   
135 ENDIF (FLTK_FLUID_EXECUTABLE) 
137 MARK_AS_ADVANCED(
138   FLTK_VERSION_1.0.11
139   FLTK_VERSION_1.1
140   FLTK_WRAP_UI