CMake enhancements, as discussed in STR #3055.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10342 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2014-09-27 00:41:06 +00:00
parent 8ef6520fe3
commit 318c3619dc
16 changed files with 285 additions and 528 deletions

View File

@ -1,49 +1,16 @@
# #
# FLTKConfig.cmake - FLTK CMake configuration file for external projects. # FLTKConfig.cmake - FLTK CMake configuration file for external projects.
# #
# This file is configured by FLTK and used by the UseFLTK.cmake module # This file is generated by CMake and used to load FLTK's settings for an external project.
# to load FLTK's settings for an external project. # It defines the following variables
# FLTK_INCLUDE_DIRS - FLTK include directories
# FLTK_LIBRARIES - list of FLTK libraries built
# FLTK_FLUID_EXECUTABLE needed by fltk_wrap_ui()
# FLTK_USE_FILE - sets things up to use FLTK
set(FLTK_FOUND TRUE)
set(FLTK_VERSION @FLTK_VERSION_FULL@) set(FLTK_VERSION @FLTK_VERSION_FULL@)
set(FLTK_FLUID_EXECUTABLE "@FLTK_FLUID_PATH@") include(${CMAKE_CURRENT_LIST_DIR}/FLTK-Targets.cmake)
if("@EXE_LINKER_FLAGS@" MATCHES "[-_A-Za-z0-9]+")) set(FLTK_INCLUDE_DIRS "@INCLUDE_DIRS@")
set(FLTK_EXE_LINKER_FLAGS "@EXE_LINKER_FLAGS@") set(FLTK_USE_FILE ${CMAKE_CURRENT_LIST_DIR}/UseFLTK.cmake)
endif("@EXE_LINKER_FLAGS@" MATCHES "[-_A-Za-z0-9]+")
set(FLTK_USE_FILE "@PREFIX_CONFIG@/UseFLTK.cmake")
set(FLTK_DIR "@PREFIX_CONFIG@")
set(FLTK_BIN_DIR "@PREFIX_BIN@")
set(FLTK_LIB_DIR "@PREFIX_LIB@")
set(FLTK_INCLUDE_DIR "@PREFIX_INCLUDE@")
set(FLTK_DATA_DIR "@PREFIX_DATA@")
set(FLTK_DOC_DIR "@PREFIX_DOC@")
set(FLTK_SHARED_LIBS_FOUND @OPTION_BUILD_SHARED_LIBS@)
set(FLTK_CAIRO_FOUND @FLTK_CAIRO_FOUND@)
set(FLTK_GL_FOUND @FLTK_GL_FOUND@)
set(FLTK_THREADS_FOUND @FLTK_THREADS_FOUND@)
set(FLTK_PTHREADS_FOUND @FLTK_PTHREADS_FOUND@)
set(FLTK_BUILTIN_JPEG_FOUND @FLTK_BUILTIN_JPEG_FOUND@)
set(FLTK_BUILTIN_ZLIB_FOUND @FLTK_BUILTIN_ZLIB_FOUND@)
set(FLTK_BUILTIN_PNG_FOUND @FLTK_BUILTIN_PNG_FOUND@)
set(FLTK_XINERAMA_FOUND @FLTK_XINERAMA_FOUND@)
set(FLTK_XFT_FOUND @FLTK_XFT_FOUND@)
set(FLTK_XDBE_FOUND @FLTK_XDBE_FOUND@)
set(FLTK_CAIRO_FOUND @FLTK_CAIRO_FOUND@)
set(FLTK_GL_FOUND @FLTK_GL_FOUND@)
set(FLTK_THREADS_FOUND @FLTK_THREADS_FOUND@)
set(FLTK_PTHREADS_FOUND @FLTK_PTHREADS_FOUND@)
set(FLTK_BUILTIN_JPEG_FOUND @FLTK_BUILTIN_JPEG_FOUND@)
set(FLTK_BUILTIN_ZLIB_FOUND @FLTK_BUILTIN_ZLIB_FOUND@)
set(FLTK_BUILTIN_PNG_FOUND @FLTK_BUILTIN_PNG_FOUND@)
set(FLTK_XINERAMA_FOUND @FLTK_XINERAMA_FOUND@)
set(FLTK_XFT_FOUND @FLTK_XFT_FOUND@)
set(FLTK_XDBE_FOUND @FLTK_XDBE_FOUND@)
include("@PREFIX_CONFIG@/FLTKLibraries.cmake")

View File

@ -1,8 +1,25 @@
# #
# UseFLTK.CMake - FLTK CMake environment configuration file for external projects.
#
# This file is generated by CMake and used to set FLTK's environment for an external project.
#
# automatically generated - do not edit # automatically generated - do not edit
include_directories("@PREFIX_INCLUDE@") include_directories("@INCLUDE_DIRS@")
if(FLTK_EXE_LINKER_FLAGS) if(CMAKE_CROSSCOMPILING)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${FLTK_EXE_LINKER_FLAGS}") find_file(FLUID_PATH
endif(FLTK_EXE_LINKER_FLAGS) NAMES fluid fluid.exe
PATHS ENV PATH
NO_CMAKE_FIND_ROOT_PATH
)
add_executable(fluid IMPORTED)
set_target_properties(fluid
PROPERTIES IMPORTED_LOCATION ${FLUID_PATH}
)
set(FLTK_FLUID_EXECUTABLE ${FLUID_PATH})
else()
set(FLTK_FLUID_EXECUTABLE fluid)
endif(CMAKE_CROSSCOMPILING)
set(FLTK_WRAP_UI TRUE)

View File

@ -29,30 +29,35 @@ if(CMAKE_CROSSCOMPILING)
) )
add_executable(fluid IMPORTED) add_executable(fluid IMPORTED)
set(FLTK_FLUID_EXECUTABLE ${FLUID_PATH}) set(FLTK_FLUID_EXECUTABLE ${FLUID_PATH})
set(FLTK_FLUID_PATH ${FLUID_PATH}) set(FLUID) # no export
set_target_properties(fluid set_target_properties(fluid
PROPERTIES IMPORTED_LOCATION ${FLUID_PATH} PROPERTIES IMPORTED_LOCATION ${FLUID_PATH}
) )
else() else()
add_subdirectory(fluid) add_subdirectory(fluid)
set(FLTK_FLUID_EXECUTABLE fluid) set(FLTK_FLUID_EXECUTABLE fluid)
set(FLTK_FLUID_PATH ${PREFIX_BIN}/fluid) set(FLUID fluid) # export
endif(CMAKE_CROSSCOMPILING) endif(CMAKE_CROSSCOMPILING)
add_subdirectory(src) add_subdirectory(src)
# generate FLTKConfig.cmake # generate FLTK-Targets.cmake for build directory use
string(REPLACE ";" " " EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") export(TARGETS ${FLUID} ${FLTK_LIBRARIES} FILE ${CMAKE_BINARY_DIR}/FLTK-Targets.cmake)
# generate FLTKConfig.cmake for build directory use
set(INCLUDE_DIRS "@FLTK_INCLUDE_DIRS@")
set(CONFIG_PATH @FLTK_BINARY_DIR@)
configure_file( configure_file(
${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in ${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
${EXECUTABLE_OUTPUT_PATH}/FLTKConfig.cmake ${FLTK_BINARY_DIR}/FLTKConfig.cmake
@ONLY @ONLY
) )
# generate UseFLTK.cmake # generate UseFLTK.cmake for build directory use
configure_file( configure_file(
${FLTK_SOURCE_DIR}/CMake/UseFLTK.cmake.in ${FLTK_SOURCE_DIR}/CMake/UseFLTK.cmake.in
${EXECUTABLE_OUTPUT_PATH}/UseFLTK.cmake ${FLTK_BINARY_DIR}/UseFLTK.cmake
@ONLY @ONLY
) )
@ -92,4 +97,3 @@ if(OPTION_CREATE_LINKS)
@ONLY @ONLY
) )
endif(OPTION_CREATE_LINKS) endif(OPTION_CREATE_LINKS)
#

View File

@ -32,7 +32,7 @@ add_custom_target(uninstall
) )
install(DIRECTORY ${FLTK_SOURCE_DIR}/FL install(DIRECTORY ${FLTK_SOURCE_DIR}/FL
DESTINATION ${PREFIX_INCLUDE} USE_SOURCE_PERMISSIONS DESTINATION include USE_SOURCE_PERMISSIONS
PATTERN ".svn" EXCLUDE PATTERN ".svn" EXCLUDE
) )
@ -40,29 +40,41 @@ if(OPTION_CREATE_LINKS)
install(SCRIPT ${FLTK_BINARY_DIR}/install-symlinks.cmake) install(SCRIPT ${FLTK_BINARY_DIR}/install-symlinks.cmake)
endif(OPTION_CREATE_LINKS) endif(OPTION_CREATE_LINKS)
install(PROGRAMS ${FLTK_BINARY_DIR}/fltk-config # generate FLTKConfig.cmake for installed directory use
DESTINATION ${PREFIX_BIN} set(INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include)
OPTIONAL
set(CONFIG_PATH ${CMAKE_INSTALL_PREFIX}/@FLTK_CONFIG_PATH@)
install(EXPORT FLTK-Targets
DESTINATION ${FLTK_CONFIG_PATH}
FILE FLTK-Targets.cmake
) )
install(EXPORT fltk-install configure_file(
DESTINATION ${PREFIX_CONFIG} ${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
FILE FLTKLibraries.cmake ${FLTK_BINARY_DIR}/etc/FLTKConfig.cmake
@ONLY
) )
install(FILES ${EXECUTABLE_OUTPUT_PATH}/FLTKConfig.cmake install(FILES ${FLTK_BINARY_DIR}/etc/FLTKConfig.cmake
DESTINATION ${PREFIX_CONFIG} DESTINATION ${FLTK_CONFIG_PATH}
) )
install(FILES ${EXECUTABLE_OUTPUT_PATH}/UseFLTK.cmake configure_file(
DESTINATION ${PREFIX_CONFIG} ${FLTK_SOURCE_DIR}/CMake/UseFLTK.cmake.in
${FLTK_BINARY_DIR}/etc/UseFLTK.cmake
@ONLY
) )
if(CMAKE_HOST_UNIX) install(FILES ${FLTK_BINARY_DIR}/etc/UseFLTK.cmake
DESTINATION ${FLTK_CONFIG_PATH}
)
if(UNIX)
macro(INSTALL_MAN FILE LEVEL) macro(INSTALL_MAN FILE LEVEL)
install(FILES install(FILES
${FLTK_SOURCE_DIR}/documentation/src/${FILE}.man ${FLTK_SOURCE_DIR}/documentation/src/${FILE}.man
DESTINATION ${PREFIX_MAN}/man${LEVEL} DESTINATION man/man${LEVEL}
RENAME ${FILE}.${LEVEL} RENAME ${FILE}.${LEVEL}
) )
endmacro(INSTALL_MAN FILE LEVEL) endmacro(INSTALL_MAN FILE LEVEL)
@ -74,4 +86,4 @@ if(CMAKE_HOST_UNIX)
INSTALL_MAN(checkers 6) INSTALL_MAN(checkers 6)
INSTALL_MAN(sudoku 6) INSTALL_MAN(sudoku 6)
endif(CMAKE_HOST_UNIX) endif(UNIX)

View File

@ -34,114 +34,24 @@ set(OPTION_ARCHFLAGS ""
add_definitions(${OPTION_ARCHFLAGS}) add_definitions(${OPTION_ARCHFLAGS})
####################################################################### #######################################################################
set(OPTION_PREFIX_BIN ""
CACHE STRING
"where to install executables - leave empty to use {CMAKE_INSTALL_PREFIX}/bin"
)
if(OPTION_PREFIX_BIN)
set(PREFIX_BIN ${OPTION_PREFIX_BIN} CACHE INTERNAL "" FORCE)
else()
set(PREFIX_BIN ${CMAKE_INSTALL_PREFIX}/bin CACHE INTERNAL "" FORCE)
endif(OPTION_PREFIX_BIN)
####################################################################### #######################################################################
set(OPTION_PREFIX_LIB "" if(UNIX)
CACHE STRING
"where to install libraries - leave empty to use {CMAKE_INSTALL_PREFIX}/lib"
)
if(OPTION_PREFIX_LIB)
set(PREFIX_LIB ${OPTION_PREFIX_LIB} CACHE INTERNAL "" FORCE)
else()
set(PREFIX_LIB ${CMAKE_INSTALL_PREFIX}/lib CACHE INTERNAL "" FORCE)
endif(OPTION_PREFIX_LIB)
#######################################################################
set(OPTION_PREFIX_INCLUDE ""
CACHE STRING
"where to install include files - leave empty to use {CMAKE_INSTALL_PREFIX}/include"
)
if(OPTION_PREFIX_INCLUDE)
set(PREFIX_INCLUDE ${OPTION_PREFIX_INCLUDE} CACHE INTERNAL "" FORCE)
else()
set(PREFIX_INCLUDE ${CMAKE_INSTALL_PREFIX}/include CACHE INTERNAL "" FORCE)
endif(OPTION_PREFIX_INCLUDE)
#######################################################################
set(OPTION_PREFIX_DATA ""
CACHE STRING
"where to install data files - leave empty to use {CMAKE_INSTALL_PREFIX}/share/FLTK"
)
if(OPTION_PREFIX_DATA)
set(PREFIX_DATA ${OPTION_PREFIX_DATA} CACHE INTERNAL "" FORCE)
else()
set(PREFIX_DATA ${CMAKE_INSTALL_PREFIX}/share/FLTK CACHE INTERNAL "" FORCE)
endif(OPTION_PREFIX_DATA)
#######################################################################
set(OPTION_PREFIX_DOC ""
CACHE STRING
"where to install doc files - leave empty to use {CMAKE_INSTALL_PREFIX}/share/doc/FLTK"
)
if(OPTION_PREFIX_DOC)
set(PREFIX_DOC ${OPTION_PREFIX_DOC} CACHE INTERNAL "" FORCE)
else()
set(PREFIX_DOC ${CMAKE_INSTALL_PREFIX}/share/doc/FLTK CACHE INTERNAL "" FORCE)
endif(OPTION_PREFIX_DOC)
#######################################################################
if(WIN32)
set(DEFAULT_CONFIG "${CMAKE_INSTALL_PREFIX}/CMake")
elseif(APPLE)
set(DEFAULT_CONFIG "${CMAKE_INSTALL_PREFIX}/FLTK/.framework/Resources/CMake")
else()
set(DEFAULT_CONFIG "${CMAKE_INSTALL_PREFIX}/lib/FLTK-${FLTK_VERSION}")
endif(WIN32)
set(OPTION_PREFIX_CONFIG ""
CACHE STRING
"where to install CMake config files - leave empty to use ${DEFAULT_CONFIG}"
)
if(OPTION_PREFIX_CONFIG)
set(PREFIX_CONFIG "${OPTION_PREFIX_CONFIG}" CACHE INTERNAL "" FORCE)
else()
set(PREFIX_CONFIG "${DEFAULT_CONFIG}" CACHE INTERNAL "" FORCE)
endif(OPTION_PREFIX_CONFIG)
#######################################################################
if(CMAKE_HOST_UNIX)
set(OPTION_PREFIX_MAN ""
CACHE STRING
"where to install man files - leave empty to use {CMAKE_INSTALL_PREFIX}/man"
)
if(OPTION_PREFIX_MAN)
set(PREFIX_MAN ${OPTION_PREFIX_MAN} CACHE INTERNAL "" FORCE)
else()
set(PREFIX_MAN ${CMAKE_INSTALL_PREFIX}/man CACHE INTERNAL "" FORCE)
endif(OPTION_PREFIX_MAN)
option(OPTION_CREATE_LINKS "create backwards compatibility links" OFF) option(OPTION_CREATE_LINKS "create backwards compatibility links" OFF)
endif(CMAKE_HOST_UNIX) endif(UNIX)
####################################################################### #######################################################################
if(APPLE) if(APPLE)
option(OPTION_APPLE_X11 "use X11" OFF) option(OPTION_APPLE_X11 "use X11" OFF)
endif(APPLE) endif(APPLE)
if(NOT APPLE OR OPTION_APPLE_X11) if((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
include(FindX11) include(FindX11)
if(X11_FOUND) if(X11_FOUND)
set(USE_X11 1) set(USE_X11 1)
list(APPEND FLTK_CFLAGS -DUSE_X11) list(APPEND FLTK_CFLAGS -DUSE_X11)
list(APPEND FLTK_LDLIBS -lX11) list(APPEND FLTK_LDLIBS -lX11)
endif(X11_FOUND) endif(X11_FOUND)
endif(NOT APPLE OR OPTION_APPLE_X11) endif((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
####################################################################### #######################################################################
option(OPTION_USE_POLL "use poll if available" OFF) option(OPTION_USE_POLL "use poll if available" OFF)
@ -151,7 +61,10 @@ if(OPTION_USE_POLL)
endif(OPTION_USE_POLL) endif(OPTION_USE_POLL)
####################################################################### #######################################################################
option(OPTION_BUILD_SHARED_LIBS "Build shared libraries" OFF) option(OPTION_BUILD_SHARED_LIBS
"Build shared libraries(in addition to static libraries)"
OFF
)
####################################################################### #######################################################################
option(OPTION_BUILD_EXAMPLES "build example programs" ON) option(OPTION_BUILD_EXAMPLES "build example programs" ON)
@ -240,30 +153,6 @@ if(OPTION_LARGE_FILE)
endif(NOT MSVC) endif(NOT MSVC)
endif(OPTION_LARGE_FILE) endif(OPTION_LARGE_FILE)
#######################################################################
option(OPTION_USE_SYSTEM_LIBJPEG "Use's system libjpeg" ON)
if(OPTION_USE_SYSTEM_LIBJPEG AND LIB_jpeg)
include(FindJPEG)
endif(OPTION_USE_SYSTEM_LIBJPEG AND LIB_jpeg)
if(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND)
set(FLTK_JPEG_LIBRARIES ${JPEG_LIBRARIES})
include_directories(${JPEG_INCLUDE_DIR})
set(FLTK_BUILTIN_JPEG_FOUND FALSE)
else()
add_subdirectory(jpeg)
set(FLTK_JPEG_LIBRARIES fltk_jpeg)
include_directories(${FLTK_SOURCE_DIR}/jpeg)
set(FLTK_BUILTIN_JPEG_FOUND TRUE)
endif(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND)
if(OPTION_USE_SYSTEM_LIBJPEG AND NOT JPEG_FOUND)
message(STATUS "\ncannot find system jpeg library - using built-in\n")
endif(OPTION_USE_SYSTEM_LIBJPEG AND NOT JPEG_FOUND)
set(HAVE_LIBJPEG 1)
####################################################################### #######################################################################
option(OPTION_USE_SYSTEM_ZLIB "Use's system zlib" ON) option(OPTION_USE_SYSTEM_ZLIB "Use's system zlib" ON)
@ -289,6 +178,30 @@ endif(OPTION_USE_SYSTEM_ZLIB AND NOT ZLIB_FOUND)
set(HAVE_LIBZ 1) set(HAVE_LIBZ 1)
#######################################################################
option(OPTION_USE_SYSTEM_LIBJPEG "Use's system libjpeg" ON)
if(OPTION_USE_SYSTEM_LIBJPEG AND LIB_jpeg)
include(FindJPEG)
endif(OPTION_USE_SYSTEM_LIBJPEG AND LIB_jpeg)
if(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND)
set(FLTK_JPEG_LIBRARIES ${JPEG_LIBRARIES})
include_directories(${JPEG_INCLUDE_DIR})
set(FLTK_BUILTIN_JPEG_FOUND FALSE)
else()
add_subdirectory(jpeg)
set(FLTK_JPEG_LIBRARIES fltk_jpeg)
include_directories(${FLTK_SOURCE_DIR}/jpeg)
set(FLTK_BUILTIN_JPEG_FOUND TRUE)
endif(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND)
if(OPTION_USE_SYSTEM_LIBJPEG AND NOT JPEG_FOUND)
message(STATUS "\ncannot find system jpeg library - using built-in\n")
endif(OPTION_USE_SYSTEM_LIBJPEG AND NOT JPEG_FOUND)
set(HAVE_LIBJPEG 1)
####################################################################### #######################################################################
option(OPTION_USE_SYSTEM_LIBPNG "Use's system libpng" ON) option(OPTION_USE_SYSTEM_LIBPNG "Use's system libpng" ON)

View File

@ -24,7 +24,7 @@
find_file(HAVE_ALSA_ASOUNDLIB_H alsa/asoundlib.h) find_file(HAVE_ALSA_ASOUNDLIB_H alsa/asoundlib.h)
find_file(HAVE_DIRENT_H dirent.h) find_file(HAVE_DIRENT_H dirent.h)
find_file(HAVE_DLFCN_H dlfcn.h) find_file(HAVE_DLFCN_H dlfcn.h)
find_file(HAVE_FREETYPE_H freetype.h PATH_SUFFIXES freetype2) find_file(HAVE_FREETYPE_H freetype.h PATH_SUFFIXES freetype2 freetype2/freetype)
find_file(HAVE_GL_GL_H GL/gl.h) find_file(HAVE_GL_GL_H GL/gl.h)
find_file(HAVE_GL_GLU_H GL/glu.h) find_file(HAVE_GL_GLU_H GL/glu.h)
find_file(HAVE_LIBPNG_PNG_H libpng/png.h) find_file(HAVE_LIBPNG_PNG_H libpng/png.h)
@ -51,6 +51,7 @@ mark_as_advanced(HAVE_SYS_STDTYPES_H HAVE_XDBE_H)
# where to find freetype headers # where to find freetype headers
find_path(FREETYPE_PATH freetype.h PATH_SUFFIXES freetype2) find_path(FREETYPE_PATH freetype.h PATH_SUFFIXES freetype2)
find_path(FREETYPE_PATH freetype/freetype.h PATH_SUFFIXES freetype2)
if(FREETYPE_PATH) if(FREETYPE_PATH)
include_directories(${FREETYPE_PATH}) include_directories(${FREETYPE_PATH})
endif(FREETYPE_PATH) endif(FREETYPE_PATH)

View File

@ -34,18 +34,39 @@ set(ARCHIVE_OUTPUT_PATH ${FLTK_BINARY_DIR}/lib)
# Search for modules in the FLTK source dir first # Search for modules in the FLTK source dir first
set(CMAKE_MODULE_PATH "${FLTK_SOURCE_DIR}/CMake") set(CMAKE_MODULE_PATH "${FLTK_SOURCE_DIR}/CMake")
include_directories(${FLTK_BINARY_DIR} ${FLTK_SOURCE_DIR}) set(FLTK_INCLUDE_DIRS ${FLTK_BINARY_DIR} ${FLTK_SOURCE_DIR})
include_directories(${FLTK_INCLUDE_DIRS})
####################################################################### #######################################################################
# platform dependent information # platform dependent information
####################################################################### #######################################################################
# fix no WIN32 defined issue
if(NOT WIN32)
if(_WIN32)
set(WIN32 _WIN32)
elseif(__WIN32__)
set(WIN32 __WIN32__)
endif(_WIN32)
endif(NOT WIN32)
# set where config and example files go
if(WIN32 AND NOT CYGWIN)
set(FLTK_CONFIG_PATH CMake)
set(FLTK_EXAMPLES_PATH bin/fltk-examples)
elseif(APPLE)
set(FLTK_CONFIG_PATH FLTK/.framework/Resources/CMake)
set(FLTK_EXAMPLES_PATH share/fltk-examples)
else()
set(FLTK_CONFIG_PATH lib/fltk)
set(FLTK_EXAMPLES_PATH share/fltk-examples)
endif(WIN32 AND NOT CYGWIN)
include(TestBigEndian) include(TestBigEndian)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN) TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
if(APPLE) if(APPLE)
set(__APPLE_QUARTZ__ 1) set(__APPLE_QUARTZ__ 1)
set(HAVE_STRTOLL 1)
set(HAVE_STRCASECMP 1) set(HAVE_STRCASECMP 1)
set(HAVE_DIRENT_H 1) set(HAVE_DIRENT_H 1)
set(HAVE_SNPRINTF 1) set(HAVE_SNPRINTF 1)
@ -60,6 +81,9 @@ if(WIN32)
if(MSVC) if(MSVC)
add_definitions(-DWIN32_LEAN_AND_MEAN) add_definitions(-DWIN32_LEAN_AND_MEAN)
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
######## from ide/VisualC2010/config.h
set(BORDER_WIDTH 2)
########
endif(MSVC) endif(MSVC)
if(CMAKE_C_COMPILER_ID STREQUAL GNU) if(CMAKE_C_COMPILER_ID STREQUAL GNU)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-subsystem,windows") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-subsystem,windows")

View File

@ -18,7 +18,12 @@
# #
project(FLTK) project(FLTK)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.6)
#######################################################################
# define some macros
#######################################################################
include(CMake/macros.cmake)
####################################################################### #######################################################################
# basic setup # basic setup

View File

@ -1,4 +1,4 @@
README.CMake.txt - 2010-12-20 - Building and using FLTK with CMake README.CMake.txt - 2014-09-27 - Building and using FLTK with CMake
------------------------------------------------------------------ ------------------------------------------------------------------
@ -98,16 +98,6 @@ OPTION_OPTIM
OPTION_ARCHFLAGS OPTION_ARCHFLAGS
Extra architecture flags. Extra architecture flags.
OPTION_PREFIX_BIN
OPTION_PREFIX_LIB
OPTION_PREFIX_INCLUDE
OPTION_PREFIX_DATA
OPTION_PREFIX_DOC
OPTION_PREFIX_CONFIG
OPTION_PREFIX_MAN
The OPTION_PREFIX_* flags are for fine-tuning where everything goes
on the install.
OPTION_APPLE_X11 - default OFF OPTION_APPLE_X11 - default OFF
In case you want to use X11 on OSX. Not currently supported. In case you want to use X11 on OSX. Not currently supported.
@ -218,6 +208,11 @@ install it in the /usr/i486-mingw32/usr tree.
USING CMAKE WITH FLTK USING CMAKE WITH FLTK
======================= =======================
The CMake Export/Import facility can be thought of as an automated
fltk-config. For example, if you link your program to the fltk
library, it will automatically link in all of its dependencies. This
includes any special flags. ie on Linux it includes the -lpthread flag.
This howto assumes that you have FLTK libraries which were built using This howto assumes that you have FLTK libraries which were built using
CMake, installed. Building them with CMake generates some CMake helper CMake, installed. Building them with CMake generates some CMake helper
files which are installed in standard locations, making FLTK easy to find files which are installed in standard locations, making FLTK easy to find
@ -231,6 +226,12 @@ cmake_minimum_required(VERSION 2.6)
project(hello) project(hello)
# the following line is required only if you don't install FLTK
# or if find_package can't find your installation directory
# it points to the build directory or the base folder,
# not the library folder.
set(FLTK_DIR /path/to/fltk)
find_package(FLTK REQUIRED NO_MODULE) find_package(FLTK REQUIRED NO_MODULE)
include(${FLTK_USE_FILE}) include(${FLTK_USE_FILE})
@ -240,21 +241,20 @@ target_link_libraries(hello fltk)
------ ------
The set(FLTK_DIR ...) command is a superhint to the find_package command.
This is very useful if you don't install or have a non-standard install.
The find_package command tells CMake to find the package FLTK, REQUIRED The find_package command tells CMake to find the package FLTK, REQUIRED
means that it is an error if it's not found. NO_MODULE tells it to search means that it is an error if it's not found. NO_MODULE tells it to search
only for the FLTKConfig file, not using the FindFLTK.cmake supplied with only for the FLTKConfig file, not using the FindFLTK.cmake supplied with
CMake, which doesn't work with this version of FLTK. CMake, which doesn't work with this version of FLTK.
Once the package is found we include the ${FLTK_USE_FILE} which adds the Once the package is found we include the ${FLTK_USE_FILE} which adds the
FLTK include directories and library link information to its knowledge FLTK include directories to its knowledge base. After that your programs
base. After that your programs will be able to find FLTK headers and will be able to find FLTK headers.
when you link the fltk library, it automatically links the libraries
fltk depends on.
The WIN32 in the add_executable tells your Windows compiler that this is The WIN32 in the add_executable tells your Windows compiler that this is
a gui app. It is ignored on other platforms. a gui app. It is ignored on other platforms.
LIBRARY NAMES LIBRARY NAMES
--------------- ---------------
@ -301,3 +301,4 @@ when find_package(FLTK REQUIRED NO_MODULE) succeeds.
Dec 20 2010 - matt: merged and restructures Dec 20 2010 - matt: merged and restructures
May 15 2013 - erco: small formatting tweaks, added some examples May 15 2013 - erco: small formatting tweaks, added some examples
Feb 23 2014 - msurette: updated to reflect changes to the CMake files

View File

@ -1,27 +1,17 @@
project(FLTKcairo)
include_directories(${FLTKcairo_SOURCE_DIR})
include_directories(${FLTKcairo_BINARY_DIR})
include_directories(${PKG_CAIRO_INCLUDE_DIRS}) include_directories(${PKG_CAIRO_INCLUDE_DIRS})
# source files for cairo # source files for cairo
set(cairo_SRCS Fl_Cairo.cxx) set(cairo_SRCS Fl_Cairo.cxx)
####################################################################### #######################################################################
add_library(fltk_cairo ${cairo_SRCS}) FL_ADD_LIBRARY(fltk_cairo STATIC "${cairo_SRCS}")
if(MSVC) #######################################################################
set_target_properties(fltk_cairo if(OPTION_BUILD_SHARED_LIBS)
PROPERTIES #######################################################################
OUTPUT_NAME fltkcairo FL_ADD_LIBRARY(fltk_cairo SHARED "${cairo_SRCS}")
DEBUG_OUTPUT_NAME fltkcairod
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_cairo PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
endif(MSVC)
install(TARGETS fltk_cairo #######################################################################
EXPORT fltk-install endif(OPTION_BUILD_SHARED_LIBS)
DESTINATION ${PREFIX_LIB} #######################################################################
)

View File

@ -25,15 +25,6 @@ add_executable(fluid ${CPPFILES})
target_link_libraries(fluid fltk fltk_images fltk_forms) target_link_libraries(fluid fltk fltk_images fltk_forms)
# link in optional libraries # link in optional libraries
if(FLTK_HAVE_CAIRO)
target_link_libraries(fluid fltk_cairo)
endif(FLTK_HAVE_CAIRO)
if(FLTK_USE_GL)
target_link_libraries(fluid fltk_gl)
target_link_libraries(fluid ${OPENGL_LIBRARIES})
endif(FLTK_USE_GL)
if(USE_XFT) if(USE_XFT)
target_link_libraries(fluid ${X11_Xft_LIB}) target_link_libraries(fluid ${X11_Xft_LIB})
endif(USE_XFT) endif(USE_XFT)
@ -43,6 +34,8 @@ if(HAVE_XINERAMA)
endif(HAVE_XINERAMA) endif(HAVE_XINERAMA)
install(TARGETS fluid install(TARGETS fluid
EXPORT fltk-install EXPORT FLTK-Targets
DESTINATION ${PREFIX_BIN} RUNTIME DESTINATION bin
) LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)

View File

@ -1,9 +1,3 @@
project(FLTKJPEG)
include_regular_expression("^j.*[.][c|h]$")
include_directories(${FLTKJPEG_SOURCE_DIR})
include_directories(${FLTKJPEG_BINARY_DIR})
# memmgr back ends: compile only one of these into a working library # memmgr back ends: compile only one of these into a working library
# (For now, let's use the mode that requires the image fit into memory. # (For now, let's use the mode that requires the image fit into memory.
@ -31,21 +25,16 @@ set(decompression_SRCS
jdsample.c jdcolor.c jquant1.c jquant2.c jdmerge.c jdsample.c jdcolor.c jquant1.c jquant2.c jdmerge.c
) )
list(APPEND BUILD_SRCS "${systemdependent_SRCS};${common_SRCS}")
list(APPEND BUILD_SRCS "${compression_SRCS};${decompression_SRCS}")
####################################################################### #######################################################################
add_library(fltk_jpeg ${systemdependent_SRCS} ${common_SRCS} ${compression_SRCS} ${decompression_SRCS}) FL_ADD_LIBRARY(fltk_jpeg STATIC "${BUILD_SRCS}")
if(MSVC) #######################################################################
set_target_properties(fltk_jpeg if(OPTION_BUILD_SHARED_LIBS)
PROPERTIES #######################################################################
OUTPUT_NAME fltkjpeg FL_ADD_LIBRARY(fltk_jpeg SHARED "${BUILD_SRCS}")
DEBUG_OUTPUT_NAME fltkjpegd
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_jpeg PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
endif(MSVC)
install(TARGETS fltk_jpeg #######################################################################
EXPORT fltk-install endif(OPTION_BUILD_SHARED_LIBS)
DESTINATION ${PREFIX_LIB} #######################################################################
)

View File

@ -1,11 +1,3 @@
project(FLTKPNG)
include_regular_expression("^png.*[.][c|h]$")
include_directories(${FLTKZLIB_SOURCE_DIR})
include_directories(${ZLIB_INCLUDE_DIR})
include_directories(${FLTKPNG_SOURCE_DIR})
include_directories(${FLTKPNG_BINARY_DIR})
# source files for png # source files for png
set(PNG_SRCS set(PNG_SRCS
@ -16,20 +8,25 @@ set(PNG_SRCS
) )
####################################################################### #######################################################################
add_library(fltk_png ${PNG_SRCS}) FL_ADD_LIBRARY(fltk_png STATIC "${PNG_SRCS}")
if(MSVC) if(OPTION_USE_SYSTEM_ZLIB)
set_target_properties(fltk_png PROPERTIES OUTPUT_NAME fltkpng) target_link_libraries(fltk_png ${FLTK_ZLIB_LIBRARIES})
if(OPTION_LARGE_FILE)
set_target_properties(fltk_png PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
else() else()
set_target_properties(fltk_png PROPERTIES OUTPUT_NAME fltk_png) target_link_libraries(fltk_png fltk_z)
endif(MSVC) endif(OPTION_USE_SYSTEM_ZLIB)
target_link_libraries(fltk_png ${FLTK_ZLIB_LIBRARIES}) #######################################################################
if(OPTION_BUILD_SHARED_LIBS)
#######################################################################
FL_ADD_LIBRARY(fltk_png SHARED "${PNG_SRCS}")
install(TARGETS fltk_png if(OPTION_USE_SYSTEM_ZLIB)
EXPORT fltk-install target_link_libraries(fltk_png_SHARED ${FLTK_ZLIB_LIBRARIES})
DESTINATION ${PREFIX_LIB} else()
) target_link_libraries(fltk_png_SHARED fltk_z_SHARED)
endif(OPTION_USE_SYSTEM_ZLIB)
#######################################################################
endif(OPTION_BUILD_SHARED_LIBS)
#######################################################################

View File

@ -1,4 +1,3 @@
include_regular_expression("[.][cxx|c|h]$")
set(CPPFILES set(CPPFILES
Fl.cxx Fl.cxx
@ -19,6 +18,7 @@ set(CPPFILES
Fl_Counter.cxx Fl_Counter.cxx
Fl_Device.cxx Fl_Device.cxx
Fl_Dial.cxx Fl_Dial.cxx
Fl_Help_Dialog_Dox.cxx
Fl_Double_Window.cxx Fl_Double_Window.cxx
Fl_File_Browser.cxx Fl_File_Browser.cxx
Fl_File_Chooser.cxx Fl_File_Chooser.cxx
@ -212,18 +212,7 @@ else()
endif(APPLE) endif(APPLE)
####################################################################### #######################################################################
add_library(fltk STATIC ${CPPFILES} ${MMFILES} ${CFILES} fl_call_main.c) FL_ADD_LIBRARY(fltk STATIC "${CPPFILES};${MMFILES};${CFILES};fl_call_main.c")
set_target_properties(fltk PROPERTIES CLEAN_DIRECT_OUTPUT 1)
if(MSVC)
if(OPTION_LARGE_FILE)
set_target_properties(fltk PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif()
set_target_properties(fltk
PROPERTIES
OUTPUT_NAME fltk
DEBUG_OUTPUT_NAME fltkd
)
endif(MSVC)
if(USE_THREADS) if(USE_THREADS)
target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl}) target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl})
@ -261,64 +250,36 @@ if(USE_XFT)
endif(USE_XFT) endif(USE_XFT)
####################################################################### #######################################################################
add_library(fltk_forms STATIC ${FLCPPFILES}) FL_ADD_LIBRARY(fltk_forms STATIC "${FLCPPFILES}")
target_link_libraries(fltk_forms fltk) target_link_libraries(fltk_forms fltk)
set_target_properties(fltk_forms
PROPERTIES CLEAN_DIRECT_OUTPUT 1
)
if(MSVC)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_forms PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif()
set_target_properties(fltk_forms
PROPERTIES
OUTPUT_NAME fltkforms
DEBUG_OUTPUT_NAME fltkformsd
)
endif(MSVC)
####################################################################### #######################################################################
add_library(fltk_images STATIC ${IMGCPPFILES}) FL_ADD_LIBRARY(fltk_images STATIC "${IMGCPPFILES}")
target_link_libraries(fltk_images fltk ${FLTK_PNG_LIBRARIES} target_link_libraries(fltk_images fltk ${FLTK_PNG_LIBRARIES}
${FLTK_JPEG_LIBRARIES} ${FLTK_ZLIB_LIBRARIES}) ${FLTK_JPEG_LIBRARIES} ${FLTK_ZLIB_LIBRARIES})
set_target_properties(fltk_images PROPERTIES CLEAN_DIRECT_OUTPUT 1)
if(MSVC)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_images PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif()
set_target_properties(fltk_images
PROPERTIES
OUTPUT_NAME fltkimages
DEBUG_OUTPUT_NAME fltkimagesd
)
endif(MSVC)
####################################################################### if(OPTION_USE_SYSTEM_LIBJPEG)
install(TARGETS fltk fltk_forms fltk_images target_link_libraries(fltk_images ${FLTK_JPEG_LIBRARIES})
EXPORT fltk-install else()
DESTINATION ${PREFIX_LIB} target_link_libraries(fltk_images fltk_jpeg)
) endif(OPTION_USE_SYSTEM_LIBJPEG)
if(OPTION_USE_SYSTEM_ZLIB)
target_link_libraries(fltk_images ${FLTK_ZLIB_LIBRARIES})
else()
target_link_libraries(fltk_images fltk_z)
endif(OPTION_USE_SYSTEM_ZLIB)
if(OPTION_USE_SYSTEM_LIBPNG)
target_link_libraries(fltk_images ${FLTK_PNG_LIBRARIES})
else()
target_link_libraries(fltk_images fltk_png)
endif(OPTION_USE_SYSTEM_LIBPNG)
####################################################################### #######################################################################
if(OPENGL_FOUND) if(OPENGL_FOUND)
add_library(fltk_gl STATIC ${GLCPPFILES}) FL_ADD_LIBRARY(fltk_gl STATIC "${GLCPPFILES}")
target_link_libraries(fltk_gl fltk ${OPENGL_LIBRARIES}) target_link_libraries(fltk_gl fltk ${OPENGL_LIBRARIES})
set_target_properties(fltk_gl PROPERTIES CLEAN_DIRECT_OUTPUT 1)
if(MSVC)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_gl PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif()
set_target_properties(fltk_gl
PROPERTIES
OUTPUT_NAME fltkgl
DEBUG_OUTPUT_NAME fltkgld
)
endif(MSVC)
install(TARGETS fltk_gl
EXPORT fltk-install
DESTINATION ${PREFIX_LIB}
)
endif(OPENGL_FOUND) endif(OPENGL_FOUND)
####################################################################### #######################################################################
@ -326,25 +287,7 @@ endif(OPENGL_FOUND)
if(OPTION_BUILD_SHARED_LIBS) if(OPTION_BUILD_SHARED_LIBS)
####################################################################### #######################################################################
add_library(fltk_SHARED SHARED ${CPPFILES} ${MMFILES} ${CFILES}) FL_ADD_LIBRARY(fltk SHARED "${CPPFILES};${MMFILES};${CFILES}")
set_target_properties(fltk_SHARED
PROPERTIES CLEAN_DIRECT_OUTPUT 1
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
SOVERSION ${FLTK_VERSION_PATCH}
)
if(MSVC)
set_target_properties(fltk_SHARED
PROPERTIES
OUTPUT_NAME fltkdll
DEBUG_OUTPUT_NAME fltkdlld
COMPILE_DEFINITIONS "FL_DLL;FL_LIBRARY"
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_SHARED PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
else()
set_target_properties(fltk_SHARED PROPERTIES OUTPUT_NAME fltk)
endif(MSVC)
if(USE_THREADS) if(USE_THREADS)
target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl}) target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl})
@ -359,7 +302,7 @@ if(WIN32)
endif(WIN32) endif(WIN32)
if(FLTK_HAVE_CAIRO) if(FLTK_HAVE_CAIRO)
target_link_libraries(fltk_SHARED fltk_cairo ${PKG_CAIRO_LIBRARIES}) target_link_libraries(fltk_SHARED fltk_cairo_SHARED ${PKG_CAIRO_LIBRARIES})
ENDif(FLTK_HAVE_CAIRO) ENDif(FLTK_HAVE_CAIRO)
if(HAVE_XINERAMA) if(HAVE_XINERAMA)
@ -374,26 +317,8 @@ if(USE_XFT)
endif(USE_XFT) endif(USE_XFT)
####################################################################### #######################################################################
add_library(fltk_forms_SHARED SHARED ${FLCPPFILES}) FL_ADD_LIBRARY(fltk_forms SHARED "${FLCPPFILES}")
target_link_libraries(fltk_forms_SHARED fltk_SHARED) target_link_libraries(fltk_forms_SHARED fltk_SHARED)
set_target_properties(fltk_forms_SHARED
PROPERTIES CLEAN_DIRECT_OUTPUT 1
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
SOVERSION ${FLTK_VERSION_PATCH}
)
if(MSVC)
set_target_properties(fltk_forms_SHARED
PROPERTIES
OUTPUT_NAME fltkformsdll
DEBUG_OUTPUT_NAME fltkformsdlld
COMPILE_DEFINITIONS "FL_DLL;FL_LIBRARY"
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_forms_SHARED PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
else()
set_target_properties(fltk_forms_SHARED PROPERTIES OUTPUT_NAME fltk_forms)
endif(MSVC)
if(USE_THREADS) if(USE_THREADS)
target_link_libraries(fltk_forms_SHARED ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl}) target_link_libraries(fltk_forms_SHARED ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl})
@ -404,62 +329,33 @@ if(USE_X11)
endif(USE_X11) endif(USE_X11)
####################################################################### #######################################################################
add_library(fltk_images_SHARED SHARED ${IMGCPPFILES}) FL_ADD_LIBRARY(fltk_images SHARED "${IMGCPPFILES}")
target_link_libraries(fltk_images_SHARED fltk_SHARED target_link_libraries(fltk_images_SHARED fltk_SHARED)
${FLTK_PNG_LIBRARIES} ${FLTK_JPEG_LIBRARIES} ${FLTK_ZLIB_LIBRARIES}
)
set_target_properties(fltk_images_SHARED
PROPERTIES CLEAN_DIRECT_OUTPUT 1
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
SOVERSION ${FLTK_VERSION_PATCH}
)
if(MSVC)
set_target_properties(fltk_images_SHARED
PROPERTIES
OUTPUT_NAME fltkimagesdll
DEBUG_OUTPUT_NAME fltkimagesdlld
COMPILE_DEFINITIONS "FL_DLL;FL_LIBRARY"
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_images_SHARED PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
else()
set_target_properties(fltk_images_SHARED PROPERTIES OUTPUT_NAME fltk_images)
endif(MSVC)
####################################################################### if(OPTION_USE_SYSTEM_LIBJPEG)
install(TARGETS fltk_SHARED fltk_forms_SHARED fltk_images_SHARED target_link_libraries(fltk_images_SHARED ${FLTK_JPEG_LIBRARIES})
EXPORT fltk-install else()
DESTINATION ${PREFIX_LIB} target_link_libraries(fltk_images_SHARED fltk_jpeg_SHARED)
) endif(OPTION_USE_SYSTEM_LIBJPEG)
if(OPTION_USE_SYSTEM_ZLIB)
target_link_libraries(fltk_images_SHARED ${FLTK_ZLIB_LIBRARIES})
else()
target_link_libraries(fltk_images_SHARED fltk_z_SHARED)
endif(OPTION_USE_SYSTEM_ZLIB)
if(OPTION_USE_SYSTEM_LIBPNG)
target_link_libraries(fltk_images_SHARED ${FLTK_PNG_LIBRARIES})
else()
target_link_libraries(fltk_images_SHARED fltk_png_SHARED)
endif(OPTION_USE_SYSTEM_LIBPNG)
####################################################################### #######################################################################
if(OPENGL_FOUND) if(OPENGL_FOUND)
add_library(fltk_gl_SHARED SHARED ${GLCPPFILES}) FL_ADD_LIBRARY(fltk_gl SHARED "${GLCPPFILES}")
target_link_libraries(fltk_gl_SHARED fltk_SHARED ${OPENGL_LIBRARIES}) target_link_libraries(fltk_gl_SHARED fltk_SHARED ${OPENGL_LIBRARIES})
set_target_properties(fltk_gl_SHARED
PROPERTIES CLEAN_DIRECT_OUTPUT 1
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
SOVERSION ${FLTK_VERSION_PATCH}
)
if(MSVC)
set_target_properties(fltk_gl_SHARED
PROPERTIES
OUTPUT_NAME fltkgldll
DEBUG_OUTPUT_NAME fltkgldlld
COMPILE_DEFINITIONS "FL_DLL;FL_LIBRARY"
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_gl_SHARED PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
else()
set_target_properties(fltk_gl_SHARED PROPERTIES OUTPUT_NAME fltk_gl)
endif(MSVC)
install(TARGETS fltk_gl_SHARED
EXPORT fltk-install
DESTINATION ${PREFIX_LIB}
)
endif(OPENGL_FOUND) endif(OPENGL_FOUND)
#######################################################################
endif(OPTION_BUILD_SHARED_LIBS) endif(OPTION_BUILD_SHARED_LIBS)
#######################################################################

View File

@ -10,46 +10,6 @@ elseif(HAVE_ALSA_ASOUNDLIB_H)
set(AUDIOLIBS -lasound) set(AUDIOLIBS -lasound)
endif(WIN32) endif(WIN32)
#######################################################################
macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
set(srcs)
set(flsrcs)
foreach(src ${SOURCES})
if("${src}" MATCHES ".fl$")
list(APPEND flsrcs ${src})
else()
list(APPEND srcs ${src})
endif("${src}" MATCHES ".fl$")
endforeach(src)
if(flsrcs)
fltk_wrap_ui(${NAME} ${flsrcs})
endif(flsrcs)
add_executable(${NAME} WIN32 ${srcs} ${${NAME}_FLTK_UI_SRCS})
if(flsrcs)
add_dependencies(${NAME} ${FLTK_FLUID_EXECUTABLE})
endif(flsrcs)
target_link_libraries(${NAME} ${LIBRARIES})
# link in optional libraries
if(FLTK_HAVE_CAIRO)
target_link_libraries(${NAME} fltk_cairo)
endif(FLTK_HAVE_CAIRO)
if(USE_XFT)
target_link_libraries(${NAME} ${X11_Xft_LIB})
endif(USE_XFT)
if(HAVE_XINERAMA)
target_link_libraries(${NAME} ${X11_Xinerama_LIB})
endif(HAVE_XINERAMA)
install(TARGETS ${NAME}
DESTINATION ${PREFIX_DOC}/examples
)
endmacro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
####################################################################### #######################################################################
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
@ -137,5 +97,5 @@ endif(OPENGL_FOUND)
# Cairo demo # Cairo demo
if(FLTK_HAVE_CAIRO) if(FLTK_HAVE_CAIRO)
CREATE_EXAMPLE(cairo_test cairo_test.cxx fltk) CREATE_EXAMPLE(cairo_test cairo_test.cxx "fltk;fltk_cairo")
endif(FLTK_HAVE_CAIRO) endif(FLTK_HAVE_CAIRO)

View File

@ -1,8 +1,3 @@
project(FLTKZLIB)
include_regular_expression(regex_match "[.][h|c]$")
include_directories(${FLTKZLIB_SOURCE_DIR})
include_directories(${FLTKZLIB_BINARY_DIR})
# source files for zlib # source files for zlib
set(ZLIB_SRCS set(ZLIB_SRCS
@ -13,20 +8,13 @@ set(ZLIB_SRCS
) )
####################################################################### #######################################################################
add_library(fltk_z ${ZLIB_SRCS}) FL_ADD_LIBRARY(fltk_z STATIC "${ZLIB_SRCS}")
if(MSVC) #######################################################################
set_target_properties(fltk_z if(OPTION_BUILD_SHARED_LIBS)
PROPERTIES #######################################################################
OUTPUT_NAME zlib FL_ADD_LIBRARY(fltk_z SHARED "${ZLIB_SRCS}")
DEBUG_OUTPUT_NAME zlibd
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_z PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
endif(MSVC)
install(TARGETS fltk_z #######################################################################
EXPORT fltk-install endif(OPTION_BUILD_SHARED_LIBS)
DESTINATION ${PREFIX_LIB} #######################################################################
)