Commit Graph

9 Commits

Author SHA1 Message Date
Albrecht Schlosser
8b4af06a96 CMake: don't export unnecessary executable files
Exporting executable files means that they would appear in the CMake
config files as "imported targets". This could break the config files
of Linux and other distributions if such executables are not installed
when building FLTK programs.

The only executable files that need to be exported are the `fluid`
executables that may be used to convert .fl files during building.
2026-02-07 20:08:23 +01:00
Albrecht Schlosser
1066b69c8e 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.
2025-04-21 19:50:12 +02:00
Albrecht Schlosser
7992b0b9ab CMake: fix installation on macOS
fluid and fltk-options are now installed correctly as bundles and as
stand-alone executables side by side in the 'bin' folder relative
to CMAKE_INSTALL_PREFIX.

This works but the installation folders may be changed in the future.

Targets fltk::fluid is now exported correctly so

  find_package(FLTK CONFIG ...)

works with both the build folder and an installed version.
2024-02-14 17:06:10 +01:00
Albrecht Schlosser
f4af40fe55 Modern CMake: export shared libraries and fltk-options 2024-02-10 14:19:09 +01:00
Albrecht Schlosser
fd5cd80935 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.
2024-02-07 18:37:34 +01:00
Albrecht Schlosser
6f021d4830 CMake: Raise cmake_minimum_required from 3.12 to 3.15
Remove code that checks CMake versions lower than 3.15
2023-11-15 21:30:12 +01:00
Albrecht Schlosser
5175192755 CMake: build shared libs with OPTION_CAIROEXT (issue #250)
- remove separate libfltk_cairo to avoid cyclic dependencies, but
- keep a dummy libfltk_cairo in 1.4.0 for backwards compatibility
- move cairo/Fl_Cairo.cxx to src/Fl_Cairo.cxx
- add preliminary Cairo support for Visual Studio (MSVC)

Static linking is not affected by this change, but users building
with hand-made Makefiles will have to remove libfltk_cairo starting
with FLTK 1.4.0. The dummy library can be linked for backwards
compatibility but it will be removed later (in 1.4.x or 1.5.0).

The shared FLTK library libfltk.{so|dylib|dll|..} depends on libcairo
if and only if FLTK is built with one of the Cairo options. This has
always been the case for OPTION_CAIROEXT but is now also true if only
OPTION_CAIRO is selected, i.e. FLTK programs linked with a Cairo
enabled shared FLTK library will also be linked with libcairo. The same
is true for configure options --enable-cairo and --enable-cairoext,
respectively.

Preliminary Cairo support for MSVC now detects a Cairo installation
using the CMake variable FLTK_CAIRO_DIR which must be set by the user.
Note that this feature is temporary and may be changed in the future
for a better and more comfortable version.
2023-03-09 17:34:05 +01:00
Matthias Melcher
1aa6c4fed8 Fix position() methods that shadow Fl_Widget::position()
* `FL_DEPRECATED` macro to mark `position()` method that shadow `Fl_Widget::position()` #69 (#666)
2023-02-02 20:54:19 +01:00
Matthias Melcher
1fc269b0d4 Move global FLTK options into new app fltk-admin (#560) 2023-01-21 17:14:41 +01:00