From fd5cd809356dc73d2ede5bb2f0db25098771cb8e Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Wed, 7 Feb 2024 18:30:11 +0100 Subject: 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. --- cairo/CMakeLists.txt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'cairo') diff --git a/cairo/CMakeLists.txt b/cairo/CMakeLists.txt index f031d674f..1e1c1a02b 100644 --- a/cairo/CMakeLists.txt +++ b/cairo/CMakeLists.txt @@ -25,15 +25,19 @@ # Build dummy fltk_cairo library -set (cairo_SRCS cairo_dummy.c) +set(cairo_SRCS cairo_dummy.c) -FL_ADD_LIBRARY (fltk_cairo STATIC "${cairo_SRCS}") +fl_add_library(fltk_cairo STATIC "${cairo_SRCS}") +target_link_libraries(fltk_cairo PUBLIC fltk::fltk) -# Build shared dummy library (optional) +# Build shared dummy library(optional) -if (OPTION_BUILD_SHARED_LIBS) +if(FLTK_BUILD_SHARED_LIBS) - FL_ADD_LIBRARY (fltk_cairo SHARED "${cairo_SRCS}") - target_link_libraries (fltk_cairo_SHARED fltk_SHARED) + fl_add_library(fltk_cairo SHARED "${cairo_SRCS}") + target_link_libraries(fltk_cairo-shared PUBLIC fltk::fltk-shared) -endif (OPTION_BUILD_SHARED_LIBS) +endif(FLTK_BUILD_SHARED_LIBS) + +set(FLTK_LIBRARIES ${FLTK_LIBRARIES} PARENT_SCOPE) +set(FLTK_LIBRARIES_SHARED ${FLTK_LIBRARIES_SHARED} PARENT_SCOPE) -- cgit v1.2.3