2 # "$Id: CMakeLists.txt 8198 2011-01-06 10:24:58Z manolo $"
4 # Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
5 # Written by Andy Cedilnik and Julien Jomier
7 # Copyright 1998-2010 by Bill Spitzak and others.
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Library General Public
11 # License as published by the Free Software Foundation; either
12 # version 2 of the License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Library General Public License for more details.
19 # You should have received a copy of the GNU Library General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 # Please report all bugs and problems on the following page:
26 # http:#www.fltk.org/str.php
29 #######################################################################
31 #######################################################################
33 cmake_minimum_required(VERSION 2.6)
36 set(FLTK_VERSION_MAJOR "1")
37 set(FLTK_VERSION_MINOR "3")
38 set(FLTK_VERSION_PATCH "0")
39 set(FLTK_VERSION "${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}")
40 set(FLTK_VERSION_FULL "${FLTK_VERSION}.${FLTK_VERSION_PATCH}")
42 set(EXECUTABLE_OUTPUT_PATH ${FLTK_BINARY_DIR}/bin)
43 set(LIBRARY_OUTPUT_PATH ${FLTK_BINARY_DIR}/lib)
44 set(ARCHIVE_OUTPUT_PATH ${FLTK_BINARY_DIR}/lib)
46 # Search for modules in the FLTK source dir first
47 set(CMAKE_MODULE_PATH "${FLTK_SOURCE_DIR}/CMake")
49 include_directories(${FLTK_BINARY_DIR} ${FLTK_SOURCE_DIR})
51 #######################################################################
52 # platform dependent information
53 #######################################################################
55 include(TestBigEndian)
56 TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
59 set(__APPLE_QUARTZ__ 1)
61 set(HAVE_STRCASECMP 1)
63 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa")
68 add_definitions(-DWIN32_LEAN_AND_MEAN)
69 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
71 if(CMAKE_C_COMPILER_ID STREQUAL GNU)
72 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-subsystem,windows")
73 endif(CMAKE_C_COMPILER_ID STREQUAL GNU)
74 if(MINGW AND EXISTS /mingw)
75 list(APPEND CMAKE_PREFIX_PATH /mingw)
76 endif(MINGW AND EXISTS /mingw)
79 #######################################################################
81 include(CheckTypeSize)
83 CHECK_TYPE_SIZE(short SIZEOF_SHORT)
84 CHECK_TYPE_SIZE(int SIZEOF_INT)
85 CHECK_TYPE_SIZE(long SIZEOF_LONG)
86 CHECK_TYPE_SIZE("long long" HAVE_LONG_LONG)
88 if(${SIZEOF_SHORT} MATCHES "^2$")
89 set(U16 "unsigned short")
90 endif(${SIZEOF_SHORT} MATCHES "^2$")
92 if(${SIZEOF_INT} MATCHES "^4$")
95 if(${SIZEOF_LONG} MATCHES "^4$")
96 set(U32 "unsigned long")
97 endif(${SIZEOF_LONG} MATCHES "^4$")
98 endif(${SIZEOF_INT} MATCHES "^4$")
100 if(${SIZEOF_INT} MATCHES "^8$")
103 if(${SIZEOF_LONG} MATCHES "^8$")
104 set(U64 "unsigned long")
105 endif(${SIZEOF_LONG} MATCHES "^8$")
106 endif(${SIZEOF_INT} MATCHES "^8$")
108 #######################################################################
109 # check for headers, libraries and functions
110 #######################################################################
112 find_file(HAVE_ALSA_ASOUNDLIB_H alsa/asoundlib.h)
113 find_file(HAVE_DIRENT_H dirent.h)
114 find_file(HAVE_DLFCN_H dlfcn.h)
115 find_file(HAVE_FREETYPE_H freetype.h PATH_SUFFIXES freetype2)
116 find_file(HAVE_GL_GL_H GL/gl.h)
117 find_file(HAVE_GL_GLU_H GL/glu.h)
118 find_file(HAVE_LIBPNG_PNG_H libpng/png.h)
119 find_file(HAVE_LOCALE_H locale.h)
120 find_file(HAVE_NDIR_H ndir.h)
121 find_file(HAVE_OPENGL_GLU_H OpenGL/glu.h)
122 find_file(HAVE_PNG_H png.h)
123 find_file(HAVE_PTHREAD_H pthread.h)
124 find_file(HAVE_STDIO_H stdio.h)
125 find_file(HAVE_STRINGS_H strings.h)
126 find_file(HAVE_SYS_DIR_H sys/dir.h)
127 find_file(HAVE_SYS_NDIR_H sys/ndir.h)
128 find_file(HAVE_SYS_SELECT_H sys/select.h)
129 find_file(HAVE_SYS_STDTYPES_H sys/stdtypes.h)
131 mark_as_advanced(HAVE_ALSA_ASOUNDLIB_H HAVE_DIRENT_H HAVE_DLFCN_H)
132 mark_as_advanced(HAVE_FREETYPE_H HAVE_GL_GL_H HAVE_GL_GLU_H)
133 mark_as_advanced(HAVE_LIBPNG_PNG_H HAVE_LOCALE_H HAVE_NDIR_H)
134 mark_as_advanced(HAVE_OPENGL_GLU_H HAVE_PNG_H HAVE_PTHREAD_H)
135 mark_as_advanced(HAVE_STDIO_H HAVE_STRINGS_H HAVE_SYS_DIR_H)
136 mark_as_advanced(HAVE_SYS_NDIR_H HAVE_SYS_SELECT_H)
137 mark_as_advanced(HAVE_SYS_STDTYPES_H)
139 # where to find freetype headers
140 find_path(FREETYPE_PATH freetype/config/ftheader.h PATH_SUFFIXES freetype2)
142 include_directories(${FREETYPE_PATH})
144 mark_as_advanced(FREETYPE_PATH)
146 #######################################################################
148 find_library(LIB_CAIRO cairo)
149 find_library(LIB_fontconfig fontconfig)
150 find_library(LIB_freetype freetype)
151 find_library(LIB_GL GL)
152 find_library(LIB_MesaGL MesaGL)
153 find_library(LIB_jpeg jpeg)
154 find_library(LIB_png png)
155 find_library(LIB_zlib z)
157 mark_as_advanced(LIB_CAIRO LIB_fontconfig LIB_freetype)
158 mark_as_advanced(LIB_GL LIB_MesaGL)
159 mark_as_advanced(LIB_jpeg LIB_png LIB_zlib)
161 #######################################################################
163 include(CheckFunctionExists)
166 set(CMAKE_REQUIRED_LIBRARIES dl)
168 CHECK_FUNCTION_EXISTS(dlsym HAVE_DLSYM)
170 CHECK_FUNCTION_EXISTS(localeconv HAVE_LOCALECONV)
173 set(CMAKE_REQUIRED_LIBRARIES png)
175 CHECK_FUNCTION_EXISTS(png_get_valid HAVE_PNG_GET_VALID)
176 CHECK_FUNCTION_EXISTS(png_set_tRNS_to_alpha HAVE_PNG_SET_TRNS_TO_ALPHA)
178 CHECK_FUNCTION_EXISTS(scandir HAVE_SCANDIR)
179 CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
181 # not really true but we convert strcasecmp calls to _stricmp calls in flstring.h
183 set(HAVE_STRCASECMP 1)
185 CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
187 CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT)
188 CHECK_FUNCTION_EXISTS(strlcpy HAVE_STRLCPY)
189 CHECK_FUNCTION_EXISTS(strtoll HAVE_STRTOLL)
190 CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF)
192 set(CMAKE_REQUIRED_LIBRARIES)
194 if(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)
195 set(MSG "POSIX compatible scandir")
196 message(STATUS "Looking for ${MSG}")
199 ${FLTK_SOURCE_DIR}/CMake/posixScandir.cxx
202 message(STATUS "${MSG} - found")
203 set(HAVE_SCANDIR_POSIX 1 CACHE INTERNAL "")
205 message(STATUS "${MSG} - not found")
206 set(HAVE_SCANDIR_POSIX HAVE_SCANDIR_POSIX-NOTFOUND)
208 endif(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)
209 mark_as_advanced(HAVE_SCANDIR_POSIX)
211 #######################################################################
213 #######################################################################
216 "custom optimization flags"
218 add_definitions(${OPTION_OPTIM})
220 #######################################################################
221 set(OPTION_ARCHFLAGS ""
223 "custom architecture flags"
225 add_definitions(${OPTION_ARCHFLAGS})
227 #######################################################################
228 set(OPTION_PREFIX_BIN ""
230 "where to install executables - leave empty to use {CMAKE_INSTALL_PREFIX}/bin"
233 if(OPTION_PREFIX_BIN)
234 set(PREFIX_BIN ${OPTION_PREFIX_BIN} CACHE INTERNAL "" FORCE)
236 set(PREFIX_BIN ${CMAKE_INSTALL_PREFIX}/bin CACHE INTERNAL "" FORCE)
237 endif(OPTION_PREFIX_BIN)
239 #######################################################################
240 set(OPTION_PREFIX_LIB ""
242 "where to install libraries - leave empty to use {CMAKE_INSTALL_PREFIX}/lib"
245 if(OPTION_PREFIX_LIB)
246 set(PREFIX_LIB ${OPTION_PREFIX_LIB} CACHE INTERNAL "" FORCE)
248 set(PREFIX_LIB ${CMAKE_INSTALL_PREFIX}/lib CACHE INTERNAL "" FORCE)
249 endif(OPTION_PREFIX_LIB)
251 #######################################################################
252 set(OPTION_PREFIX_INCLUDE ""
254 "where to install include files - leave empty to use {CMAKE_INSTALL_PREFIX}/include"
257 if(OPTION_PREFIX_INCLUDE)
258 set(PREFIX_INCLUDE ${OPTION_PREFIX_INCLUDE} CACHE INTERNAL "" FORCE)
260 set(PREFIX_INCLUDE ${CMAKE_INSTALL_PREFIX}/include CACHE INTERNAL "" FORCE)
261 endif(OPTION_PREFIX_INCLUDE)
263 #######################################################################
264 set(OPTION_PREFIX_DATA ""
266 "where to install data files - leave empty to use {CMAKE_INSTALL_PREFIX}/share/FLTK"
269 if(OPTION_PREFIX_DATA)
270 set(PREFIX_DATA ${OPTION_PREFIX_DATA} CACHE INTERNAL "" FORCE)
272 set(PREFIX_DATA ${CMAKE_INSTALL_PREFIX}/share/FLTK CACHE INTERNAL "" FORCE)
273 endif(OPTION_PREFIX_DATA)
275 #######################################################################
276 set(OPTION_PREFIX_DOC ""
278 "where to install doc files - leave empty to use {CMAKE_INSTALL_PREFIX}/share/doc/FLTK"
281 if(OPTION_PREFIX_DOC)
282 set(PREFIX_DOC ${OPTION_PREFIX_DOC} CACHE INTERNAL "" FORCE)
284 set(PREFIX_DOC ${CMAKE_INSTALL_PREFIX}/share/doc/FLTK CACHE INTERNAL "" FORCE)
285 endif(OPTION_PREFIX_DOC)
287 #######################################################################
289 set(DEFAULT_CONFIG "${CMAKE_INSTALL_PREFIX}/CMake")
291 set(DEFAULT_CONFIG "${CMAKE_INSTALL_PREFIX}/FLTK/.framework/Resources/CMake")
293 set(DEFAULT_CONFIG "${CMAKE_INSTALL_PREFIX}/lib/FLTK-${FLTK_VERSION}")
296 set(OPTION_PREFIX_CONFIG ""
298 "where to install CMake config files - leave empty to use ${DEFAULT_CONFIG}"
301 if(OPTION_PREFIX_CONFIG)
302 set(PREFIX_CONFIG "${OPTION_PREFIX_CONFIG}" CACHE INTERNAL "" FORCE)
304 set(PREFIX_CONFIG "${DEFAULT_CONFIG}" CACHE INTERNAL "" FORCE)
305 endif(OPTION_PREFIX_CONFIG)
307 #######################################################################
309 set(OPTION_PREFIX_MAN ""
311 "where to install man files - leave empty to use {CMAKE_INSTALL_PREFIX}/man"
314 if(OPTION_PREFIX_MAN)
315 set(PREFIX_MAN ${OPTION_PREFIX_MAN} CACHE INTERNAL "" FORCE)
317 set(PREFIX_MAN ${CMAKE_INSTALL_PREFIX}/man CACHE INTERNAL "" FORCE)
318 endif(OPTION_PREFIX_MAN)
320 option(OPTION_CREATE_LINKS "create backwards compatibility links" OFF)
321 endif(CMAKE_HOST_UNIX)
323 #######################################################################
325 option(OPTION_APPLE_X11 "use X11" OFF)
328 if(NOT APPLE OR OPTION_APPLE_X11)
332 list(APPEND FLTK_CFLAGS -DUSE_X11)
333 list(APPEND FLTK_LDLIBS -lX11)
335 endif(NOT APPLE OR OPTION_APPLE_X11)
337 #######################################################################
338 option(OPTION_USE_POLL "use poll if available" OFF)
341 CHECK_FUNCTION_EXISTS(poll USE_POLL)
342 endif(OPTION_USE_POLL)
344 #######################################################################
345 option(OPTION_BUILD_SHARED_LIBS "Build shared libraries" OFF)
347 #######################################################################
348 option(OPTION_BUILD_EXAMPLES "build example programs" ON)
350 #######################################################################
351 include(FindPkgConfig)
353 option(OPTION_CAIRO "use lib Cairo" OFF)
354 option(OPTION_CAIROEXT
355 "use fltk code instrumentation for cairo extended use" OFF
358 if(OPTION_CAIRO OR OPTION_CAIROEXT AND LIB_CAIRO)
359 pkg_search_module(PKG_CAIRO cairo)
360 endif(OPTION_CAIRO OR OPTION_CAIROEXT AND LIB_CAIRO)
363 set(FLTK_HAVE_CAIRO 1)
364 # add_subdirectory(cairo)
365 list(APPEND FLTK_LDLIBS -lcairo -lpixman-1)
366 include_directories(${PKG_CAIRO_INCLUDE_DIRS})
367 string(REPLACE ";" " " CAIROFLAGS "${PKG_CAIRO_CFLAGS}")
368 endif(PKG_CAIRO_FOUND)
370 if(LIB_CAIRO AND OPTION_CAIROEXT AND PKG_CAIRO_FOUND)
371 set(FLTK_USE_CAIRO 1)
372 set(FLTK_CAIRO_FOUND TRUE)
374 set(FLTK_CAIRO_FOUND FALSE)
375 endif(LIB_CAIRO AND OPTION_CAIROEXT AND PKG_CAIRO_FOUND)
377 #######################################################################
378 set(HAVE_GL LIB_GL OR LIB_MesaGL)
381 option(OPTION_USE_GL "use OpenGL" ON)
389 set(CMAKE_REQUIRED_INCLUDES ${OPENGL_INCLUDE_DIR}/GL)
390 set(CMAKE_REQUIRED_LIBRARIES -lGLU -lGL)
391 CHECK_FUNCTION_EXISTS(glXGetProcAddressARB HAVE_GLXGETPROCADDRESSARB)
392 set(FLTK_GL_FOUND TRUE)
394 set(FLTK_GL_FOUND FALSE)
397 #######################################################################
398 option(OPTION_USE_THREADS "use multi-threading" ON)
400 if(OPTION_USE_THREADS)
402 endif(OPTION_USE_THREADS)
404 if(OPTION_USE_THREADS AND CMAKE_HAVE_THREADS_LIBRARY)
405 add_definitions("-D_THREAD_SAFE -D_REENTRANT")
407 set(FLTK_THREADS_FOUND TRUE)
409 set(FLTK_THREADS_FOUND FALSE)
410 endif(OPTION_USE_THREADS AND CMAKE_HAVE_THREADS_LIBRARY)
412 if(OPTION_USE_THREADS AND CMAKE_USE_PTHREADS_INIT)
414 list(APPEND FLTK_LDLIBS -lpthread)
415 list(APPEND FLTK_CFLAGS -D_THREAD_SAFE -D_REENTRANT)
416 set(FLTK_PTHREADS_FOUND TRUE)
419 set(HAVE_PTHREAD_H 0)
420 set(FLTK_PTHREADS_FOUND FALSE)
421 endif(OPTION_USE_THREADS AND CMAKE_USE_PTHREADS_INIT)
423 #######################################################################
424 option(OPTION_LARGE_FILE "enable large file support" ON)
426 if(OPTION_LARGE_FILE)
428 add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE)
429 list(APPEND FLTK_CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE)
431 endif(OPTION_LARGE_FILE)
433 #######################################################################
434 option(OPTION_USE_SYSTEM_LIBJPEG "Use's system libjpeg" ON)
436 if(OPTION_USE_SYSTEM_LIBJPEG AND LIB_jpeg)
438 endif(OPTION_USE_SYSTEM_LIBJPEG AND LIB_jpeg)
440 if(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND)
441 set(FLTK_JPEG_LIBRARIES ${JPEG_LIBRARIES})
442 include_directories(${JPEG_INCLUDE_DIR})
443 set(FLTK_BUILTIN_JPEG_FOUND FALSE)
445 add_subdirectory(jpeg)
446 set(FLTK_JPEG_LIBRARIES fltk_jpeg)
447 include_directories(${FLTK_SOURCE_DIR}/jpeg)
448 set(FLTK_BUILTIN_JPEG_FOUND TRUE)
449 endif(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND)
451 if(OPTION_USE_SYSTEM_LIBJPEG AND NOT JPEG_FOUND)
452 message(STATUS "\ncannot find system jpeg library - using built-in\n")
453 endif(OPTION_USE_SYSTEM_LIBJPEG AND NOT JPEG_FOUND)
457 #######################################################################
458 option(OPTION_USE_SYSTEM_ZLIB "Use's system zlib" ON)
460 if(OPTION_USE_SYSTEM_ZLIB AND LIB_zlib)
462 endif(OPTION_USE_SYSTEM_ZLIB AND LIB_zlib)
464 if(OPTION_USE_SYSTEM_ZLIB AND ZLIB_FOUND)
465 set(FLTK_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
466 include_directories(${ZLIB_INCLUDE_DIRS})
467 set(FLTK_BUILTIN_ZLIB_FOUND FALSE)
469 add_subdirectory(zlib)
470 set(FLTK_ZLIB_LIBRARIES fltk_z)
471 set(ZLIB_INCLUDE_DIR ${FLTK_SOURCE_DIR}/zlib)
472 include_directories(${FLTK_SOURCE_DIR}/zlib)
473 set(FLTK_BUILTIN_ZLIB_FOUND TRUE)
474 endif(OPTION_USE_SYSTEM_ZLIB AND ZLIB_FOUND)
476 if(OPTION_USE_SYSTEM_ZLIB AND NOT ZLIB_FOUND)
477 message(STATUS "\ncannot find system zlib library - using built-in\n")
478 endif(OPTION_USE_SYSTEM_ZLIB AND NOT ZLIB_FOUND)
482 #######################################################################
483 option(OPTION_USE_SYSTEM_LIBPNG "Use's system libpng" ON)
485 if(OPTION_USE_SYSTEM_LIBPNG AND LIB_png)
487 endif(OPTION_USE_SYSTEM_LIBPNG AND LIB_png)
489 if(OPTION_USE_SYSTEM_LIBPNG AND PNG_FOUND)
490 set(FLTK_PNG_LIBRARIES ${PNG_LIBRARIES})
491 include_directories(${PNG_INCLUDE_DIR})
492 add_definitions(${PNG_DEFINITIONS})
493 set(FLTK_BUILTIN_PNG_FOUND FALSE)
495 add_subdirectory(png)
496 set(FLTK_PNG_LIBRARIES fltk_png)
498 set(HAVE_PNG_GET_VALID 1)
499 set(HAVE_PNG_SET_TRNS_TO_ALPHA 1)
500 include_directories(${FLTK_SOURCE_DIR}/png)
501 set(FLTK_BUILTIN_PNG_FOUND TRUE)
502 endif(OPTION_USE_SYSTEM_LIBPNG AND PNG_FOUND)
504 if(OPTION_USE_SYSTEM_LIBPNG AND NOT PNG_FOUND)
505 message(STATUS "\ncannot find system png library - using built-in\n")
506 endif(OPTION_USE_SYSTEM_LIBPNG AND NOT PNG_FOUND)
510 #######################################################################
511 if(X11_Xinerama_FOUND)
512 option(OPTION_USE_XINERAMA "use lib Xinerama" ON)
513 endif(X11_Xinerama_FOUND)
515 if(OPTION_USE_XINERAMA)
516 set(HAVE_XINERAMA ${X11_Xinerama_FOUND})
517 include_directories(${X11_Xinerama_INCLUDE_PATH})
518 list(APPEND FLTK_LDLIBS -lXinerama)
519 set(FLTK_XINERAMA_FOUND TRUE)
521 set(FLTK_XINERAMA_FOUND FALSE)
522 endif(OPTION_USE_XINERAMA)
524 #######################################################################
526 option(OPTION_USE_XFT "use lib Xft" ON)
530 set(USE_XFT X11_Xft_FOUND)
531 list(APPEND FLTK_LDLIBS -lXft)
532 set(FLTK_XFT_FOUND TRUE)
534 set(FLTK_XFT_FOUND FALSE)
535 endif(OPTION_USE_XFT)
537 #######################################################################
538 # final setup and config
539 #######################################################################
540 # Set the fluid executable path
541 if(CMAKE_CROSSCOMPILING)
543 NAMES fluid fluid.exe
545 NO_CMAKE_FIND_ROOT_PATH
547 add_executable(fluid IMPORTED)
548 set(FLTK_FLUID_EXECUTABLE ${FLUID_PATH})
549 set(FLTK_FLUID_PATH ${FLUID_PATH})
550 set_target_properties(fluid
551 PROPERTIES IMPORTED_LOCATION ${FLUID_PATH}
554 add_subdirectory(fluid)
555 set(FLTK_FLUID_EXECUTABLE fluid)
556 set(FLTK_FLUID_PATH ${PREFIX_BIN}/fluid)
557 endif(CMAKE_CROSSCOMPILING)
559 add_subdirectory(src)
561 # generate FLTKConfig.cmake
562 string(REPLACE ";" " " EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
564 ${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
565 ${EXECUTABLE_OUTPUT_PATH}/FLTKConfig.cmake
569 # generate UseFLTK.cmake
571 ${FLTK_SOURCE_DIR}/CMake/UseFLTK.cmake.in
572 ${EXECUTABLE_OUTPUT_PATH}/UseFLTK.cmake
578 "${FLTK_SOURCE_DIR}/configh.cmake.in"
579 "${FLTK_BINARY_DIR}/config.h"
583 # generate fltk-config
584 get_filename_component(CC ${CMAKE_C_COMPILER} NAME)
585 get_filename_component(CXX ${CMAKE_CXX_COMPILER} NAME)
587 string(REPLACE ";" " " C_FLAGS "${FLTK_CFLAGS}")
590 list(APPEND FLTK_LDLIBS -lXext)
591 endif(X11_Xext_FOUND)
592 string(REPLACE ";" " " LD_LIBS "${FLTK_LDLIBS}")
595 "${FLTK_SOURCE_DIR}/fltk-config.cmake.in"
596 "${FLTK_BINARY_DIR}/fltk-config"
600 execute_process(COMMAND chmod 755 fltk-config
601 WORKING_DIRECTORY "${FLTK_BINARY_DIR}"
605 if(OPTION_CREATE_LINKS)
607 "${FLTK_SOURCE_DIR}/CMake/install-symlinks.cmake.in"
608 "${FLTK_BINARY_DIR}/install-symlinks.cmake"
611 endif(OPTION_CREATE_LINKS)
613 # generate uninstall target
615 "${CMAKE_CURRENT_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in"
616 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
619 add_custom_target(uninstall
620 "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
623 #######################################################################
624 # build examples - these have to be after fluid is built/imported
625 #######################################################################
626 if(OPTION_BUILD_EXAMPLES)
627 add_subdirectory(test)
628 endif(OPTION_BUILD_EXAMPLES)
630 #######################################################################
632 #######################################################################
634 install(DIRECTORY ${FLTK_SOURCE_DIR}/FL
635 DESTINATION ${PREFIX_INCLUDE} USE_SOURCE_PERMISSIONS
636 PATTERN ".svn" EXCLUDE
639 if(OPTION_CREATE_LINKS)
640 install(SCRIPT ${FLTK_BINARY_DIR}/install-symlinks.cmake)
641 endif(OPTION_CREATE_LINKS)
643 install(PROGRAMS ${FLTK_BINARY_DIR}/fltk-config
644 DESTINATION ${PREFIX_BIN}
648 install(EXPORT fltk-install
649 DESTINATION ${PREFIX_CONFIG}
650 FILE FLTKLibraries.cmake
653 install(FILES ${EXECUTABLE_OUTPUT_PATH}/FLTKConfig.cmake
654 DESTINATION ${PREFIX_CONFIG}
657 install(FILES ${EXECUTABLE_OUTPUT_PATH}/UseFLTK.cmake
658 DESTINATION ${PREFIX_CONFIG}
662 macro(INSTALL_MAN FILE LEVEL)
664 ${FLTK_SOURCE_DIR}/documentation/src/${FILE}.man
665 DESTINATION ${PREFIX_MAN}/man${LEVEL}
666 RENAME ${FILE}.${LEVEL}
668 endmacro(INSTALL_MAN FILE LEVEL)
671 INSTALL_MAN(fltk-config 1)
673 INSTALL_MAN(blocks 6)
674 INSTALL_MAN(checkers 6)
675 INSTALL_MAN(sudoku 6)
677 endif(CMAKE_HOST_UNIX)