fltk/cairo/CMakeLists.txt
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

40 lines
1.3 KiB
CMake

#
# CMakeLists.txt to build a dummy Cairo library for the FLTK project using CMake
#
# Copyright 1998-2023 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
#
########################################################################
# Note: since FLTK 1.4.0 Fl_Cairo_Window support [1] is included in
# libfltk and libfltk_cairo is no longer necessary. This directory is
# used to build an "empty" dummy library for backwards compatibility,
# just in case users expect it to exist.
# ----------------------------------------------------------------------
# The entire 'cairo' folder will be removed in a later FLTK release.
########################################################################
# Build dummy fltk_cairo library
set (cairo_SRCS cairo_dummy.c)
FL_ADD_LIBRARY (fltk_cairo STATIC "${cairo_SRCS}")
# Build shared dummy library (optional)
if (OPTION_BUILD_SHARED_LIBS)
FL_ADD_LIBRARY (fltk_cairo SHARED "${cairo_SRCS}")
target_link_libraries (fltk_cairo_SHARED fltk_SHARED)
endif (OPTION_BUILD_SHARED_LIBS)