diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2024-02-07 18:30:11 +0100 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2024-02-07 18:37:34 +0100 |
| commit | fd5cd809356dc73d2ede5bb2f0db25098771cb8e (patch) | |
| tree | 70c82946eb7d11eba910bb387dc3bcc20abfd42c /CMake/install.cmake | |
| parent | 1cf6fdfa8562fafa0566e1008f74ea94f71356e4 (diff) | |
Introduce "Modern CMake" in FLTK
This is a big commit and there are too many changes to list them all.
The main changes are:
- rename all CMake build options to 'FLTK_*'
- export library targets with namespace (prefix) 'fltk::'
- standardize shared library target names with suffix '-shared'
- set public build properties on libraries for consumers
- document library names and aliases in README.CMake.txt
- document changes in "Migrating Code from FLTK 1.3 to 1.4"
- partial backwards compatibility for old user projects
Included but not directly related changes:
- fix Windows (Visual Studio) DLL build
- add CMake function fl_debug_target() to show target properties
- don't build test programs if FLTK is a subproject
- internal: reformat CMake code: remove space before '('
Thanks to Matthias and Manolo for their help, testing, and feeback.
Diffstat (limited to 'CMake/install.cmake')
| -rw-r--r-- | CMake/install.cmake | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/CMake/install.cmake b/CMake/install.cmake index ea36ab301..651d8a0f1 100644 --- a/CMake/install.cmake +++ b/CMake/install.cmake @@ -2,7 +2,7 @@ # Installation support for building the FLTK project using CMake (www.cmake.org) # Originally written by Michael Surette # -# Copyright 1998-2022 by Bill Spitzak and others. +# Copyright 1998-2024 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 @@ -25,11 +25,11 @@ configure_file( "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" @ONLY ) -add_custom_target (uninstall +add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" ) -install (DIRECTORY +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/FL DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS FILES_MATCHING @@ -37,28 +37,29 @@ install (DIRECTORY PATTERN "fl_config.h" EXCLUDE ) -install (DIRECTORY +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/FL DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN "*.[hH]" ) -if (OPTION_CREATE_LINKS) - install (SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/install-symlinks.cmake) -endif (OPTION_CREATE_LINKS) +if(FLTK_INSTALL_LINKS) + install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/install-symlinks.cmake) +endif(FLTK_INSTALL_LINKS) # generate FLTKConfig.cmake for installed directory use -set (INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include) -if (FLTK_HAVE_CAIRO) - list (APPEND INCLUDE_DIRS ${PKG_CAIRO_INCLUDE_DIRS}) -endif () +set(INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include) +if(FLTK_HAVE_CAIRO) + list(APPEND INCLUDE_DIRS ${PKG_CAIRO_INCLUDE_DIRS}) +endif() -set (CONFIG_PATH ${CMAKE_INSTALL_PREFIX}/${FLTK_CONFIG_PATH}) +set(CONFIG_PATH ${CMAKE_INSTALL_PREFIX}/${FLTK_CONFIG_PATH}) -install (EXPORT FLTK-Targets +install(EXPORT FLTK-Targets DESTINATION ${FLTK_CONFIG_PATH} FILE FLTK-Targets.cmake + NAMESPACE fltk:: ) configure_file( @@ -67,26 +68,26 @@ configure_file( @ONLY ) -install (FILES +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/etc/FLTKConfig.cmake DESTINATION ${FLTK_CONFIG_PATH} ) -install (FILES +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMake/FLTK-Functions.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(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") +set(LIBNAME "${libdir}/libfltk.a") configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/fltk-config.in" @@ -95,14 +96,14 @@ configure_file( ) # Install fltk-config -# Note: no need to set execute perms, install (PROGRAMS) does this +# Note: no need to set execute perms, install(PROGRAMS) does this -install (PROGRAMS +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-config DESTINATION ${FLTK_BINDIR} ) -if (UNIX OR MSYS OR MINGW) +if(UNIX OR MSYS OR MINGW) macro(INSTALL_MAN FILE LEVEL) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/documentation/src/${FILE}.man @@ -111,20 +112,20 @@ if (UNIX OR MSYS OR MINGW) ) endmacro (INSTALL_MAN FILE LEVEL) - if (FLTK_BUILD_FLUID) + if(FLTK_BUILD_FLUID) INSTALL_MAN (fluid 1) - endif (FLTK_BUILD_FLUID) - if (FLTK_BUILD_FLTK_OPTIONS) + endif(FLTK_BUILD_FLUID) + if(FLTK_BUILD_FLTK_OPTIONS) INSTALL_MAN (fltk-options 1) - endif (FLTK_BUILD_FLTK_OPTIONS) + endif(FLTK_BUILD_FLTK_OPTIONS) INSTALL_MAN (fltk-config 1) INSTALL_MAN (fltk 3) - if (FLTK_BUILD_TEST AND FLTK_BUILD_FLUID) + if(FLTK_BUILD_TEST AND FLTK_BUILD_FLUID) # Don't (!) install man pages of games (GitHub issue #23) # INSTALL_MAN (blocks 6) # INSTALL_MAN (checkers 6) # INSTALL_MAN (sudoku 6) - endif () + endif() -endif (UNIX OR MSYS OR MINGW) +endif(UNIX OR MSYS OR MINGW) |
