From 1066b69c8e14cea5a71cac5330a8e60cb3cb3c49 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Thu, 17 Apr 2025 18:23:55 +0200 Subject: Fix "fully support ... own shared libraries" (#1238) - If shared libraries are built, then fluid, fltk-options, and the "games" are linked against the shared FLTK libraries. On some platforms the static and the shared versions of fluid and fltk-options are built. The games are only built if FLTK_BUILD_TEST is enabled. - The CMake 'install' target now installs the games (if built) and their man pages on all platforms (no matter if that is useful, for instance on Windows). - On macOS 'CMAKE_INSTALL_RPATH' is set so *installed* programs automatically find their shared FLTK libraries. The "shared" versions of fluid and fltk-options got their own '.plist' files. This works for both the executables themselves as well as those included in bundles. There may be more to do on the macOS platform. --- CMake/install.cmake | 72 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 25 deletions(-) (limited to 'CMake') diff --git a/CMake/install.cmake b/CMake/install.cmake index d88c6340d..9dfe6566f 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-2024 by Bill Spitzak and others. +# Copyright 1998-2025 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 @@ -103,29 +103,51 @@ install(PROGRAMS DESTINATION ${FLTK_BINDIR} ) -if(UNIX OR MSYS OR MINGW) - 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) - - if(FLTK_BUILD_FLUID) - INSTALL_MAN (fluid 1) - endif(FLTK_BUILD_FLUID) - if(FLTK_BUILD_FLTK_OPTIONS) - INSTALL_MAN (fltk-options 1) - endif(FLTK_BUILD_FLTK_OPTIONS) - INSTALL_MAN (fltk-config 1) - INSTALL_MAN (fltk 3) - - 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) +# Install man pages of fluid and fltk-options + +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) + +if(FLTK_BUILD_FLUID) + INSTALL_MAN (fluid 1) +endif(FLTK_BUILD_FLUID) +if(FLTK_BUILD_FLTK_OPTIONS) + INSTALL_MAN (fltk-options 1) +endif(FLTK_BUILD_FLTK_OPTIONS) +INSTALL_MAN (fltk-config 1) +INSTALL_MAN (fltk 3) + +# Install the games + +if(FLTK_BUILD_TEST) # "OR FLTK_BUILD_GAMES" (not yet implemented) + + set(games_ blocks checkers sudoku) + if(FLTK_USE_GL) + list(APPEND games_ glpuzzle) endif() -endif(UNIX OR MSYS OR MINGW) + foreach(game_ ${games_}) + if(FLTK_BUILD_SHARED_LIBS) + set(tgt_ "${game_}-shared") + set_target_properties(${tgt_} PROPERTIES RUNTIME_OUTPUT_NAME ${game_}) + else() + set(tgt_ ${game_}) + endif() + install(TARGETS ${tgt_} + EXPORT FLTK-Targets + RUNTIME DESTINATION ${FLTK_BINDIR} + LIBRARY DESTINATION ${FLTK_LIBDIR} + ARCHIVE DESTINATION ${FLTK_LIBDIR} + BUNDLE DESTINATION ${FLTK_BINDIR} # macOS: bundles + ) + # install man page + INSTALL_MAN (${game_} 6) + endforeach() + unset(game_) + unset(games_) +endif() -- cgit v1.2.3