- raise minimum CMake version from 2.6.3 to 3.2.3 (Jun 01, 2015)
- indent all CMake files according to the CMP (2 col.)
- refactor FLTK version number definitions and usage
- unify CMake and autoconf/configure variable names:
- FL_VERSION -> FLTK_VERSION
- FL_MAJOR_VERSION -> FLTK_VERSION_MAJOR
- etc. for _MINOR_ and _PATCH_, respectively
- note: this does not affect FL_VERSION etc. in source code
- generate "export headers" for all libraries (experimental: OFF)
- port some forgotten goodies from branch-1.3 to master
- merge and improve macro 'create_example' (WIP)
- remove "temporary" options and code for older CMake versions
- include and use 'GenerateExportHeader' (experimental, WIP: OFF)
- note: created header files are not yet used
- build only *one* DLL with Visual Studio (tested, works)
- similar to the bundled IDE projects in 1.3.x
- add some dynamically linked test/demo programs ('*-shared')
if shared libraries are built (WIP)
- split 'macros.cmake': use one file per macro
128 lines
3.3 KiB
CMake
128 lines
3.3 KiB
CMake
#
|
|
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
|
# Written by Michael Surette
|
|
#
|
|
# Copyright 1998-2020 by Bill Spitzak and others.
|
|
#
|
|
# This library is free software. Distribution and use rights are outlined in
|
|
# the file "COPYING" which should have been included with this file. If this
|
|
# file is missing or damaged, see the license at:
|
|
#
|
|
# https://www.fltk.org/COPYING.php
|
|
#
|
|
# Please see the following page on how to report bugs and issues:
|
|
#
|
|
# https://www.fltk.org/bugs.php
|
|
#
|
|
|
|
#######################################################################
|
|
# installation
|
|
#######################################################################
|
|
|
|
# generate uninstall target
|
|
configure_file(
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
|
@ONLY
|
|
)
|
|
add_custom_target (uninstall
|
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
|
)
|
|
|
|
install (DIRECTORY
|
|
${CMAKE_CURRENT_SOURCE_DIR}/FL
|
|
DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS
|
|
)
|
|
|
|
install (DIRECTORY
|
|
${CMAKE_CURRENT_BINARY_DIR}/FL
|
|
DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS
|
|
)
|
|
|
|
if (OPTION_CREATE_LINKS)
|
|
install (SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/install-symlinks.cmake)
|
|
endif (OPTION_CREATE_LINKS)
|
|
|
|
# generate FLTKConfig.cmake for installed directory use
|
|
set (INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include)
|
|
|
|
set (CONFIG_PATH ${CMAKE_INSTALL_PREFIX}/${FLTK_CONFIG_PATH})
|
|
|
|
install (EXPORT FLTK-Targets
|
|
DESTINATION ${FLTK_CONFIG_PATH}
|
|
FILE FLTK-Targets.cmake
|
|
)
|
|
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/etc/FLTKConfig.cmake
|
|
@ONLY
|
|
)
|
|
|
|
install (FILES
|
|
${CMAKE_CURRENT_BINARY_DIR}/etc/FLTKConfig.cmake
|
|
DESTINATION ${FLTK_CONFIG_PATH}
|
|
)
|
|
|
|
install (FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/FLTK-Functions.cmake
|
|
DESTINATION ${FLTK_CONFIG_PATH}
|
|
)
|
|
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/UseFLTK.cmake.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/etc/UseFLTK.cmake
|
|
@ONLY
|
|
)
|
|
|
|
# Deprecated: install UseFLTK.cmake with deprecation warnings only
|
|
install (FILES
|
|
${CMAKE_CURRENT_BINARY_DIR}/etc/UseFLTK.cmake
|
|
DESTINATION ${FLTK_CONFIG_PATH}
|
|
)
|
|
|
|
# generate fltk-config
|
|
set (prefix ${CMAKE_INSTALL_PREFIX})
|
|
set (exec_prefix "\${prefix}")
|
|
set (includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
|
set (BINARY_DIR)
|
|
set (libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
|
|
set (srcdir ".")
|
|
|
|
set (LIBNAME "${libdir}/libfltk.a")
|
|
|
|
configure_file(
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/fltk-config.in"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-config"
|
|
@ONLY
|
|
)
|
|
|
|
if (UNIX)
|
|
execute_process (COMMAND chmod 755 fltk-config
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
|
|
)
|
|
endif (UNIX)
|
|
|
|
install (PROGRAMS
|
|
${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-config
|
|
DESTINATION ${FLTK_BINDIR}
|
|
)
|
|
|
|
if (UNIX OR MSYS OR (MINGW AND CMAKE_CROSSCOMPILING))
|
|
macro(INSTALL_MAN FILE LEVEL)
|
|
install(FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/documentation/src/${FILE}.man
|
|
DESTINATION ${FLTK_MANDIR}/man${LEVEL}
|
|
RENAME ${FILE}.${LEVEL}
|
|
)
|
|
endmacro (INSTALL_MAN FILE LEVEL)
|
|
|
|
INSTALL_MAN (fluid 1)
|
|
INSTALL_MAN (fltk-config 1)
|
|
INSTALL_MAN (fltk 3)
|
|
INSTALL_MAN (blocks 6)
|
|
INSTALL_MAN (checkers 6)
|
|
INSTALL_MAN (sudoku 6)
|
|
|
|
endif (UNIX OR MSYS OR (MINGW AND CMAKE_CROSSCOMPILING))
|