diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2021-02-28 14:56:19 +0100 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2021-03-01 10:45:59 +0100 |
| commit | 49a78bc482bc112248a05f0b1ea78bcf80403efa (patch) | |
| tree | f57c0c1a98e240a64cb2a05fdea19d6781a5ab87 /CMake/options.cmake | |
| parent | 266b5e7cddaaca312b77abd5696e0281af3251c9 (diff) | |
Fix cairo build (autoconf + CMake) + README's
- rewrite to use pkg-config with both autoconf + CMake
- remove hardcoded library names
- fix build dependencies and search directories
- remove or replace old and unused variables
- update README files
To be done:
- implement fallback for autoconf/configure if pkg-config is missing
- fix pango build (uses cairo internally)
Diffstat (limited to 'CMake/options.cmake')
| -rw-r--r-- | CMake/options.cmake | 66 |
1 files changed, 46 insertions, 20 deletions
diff --git a/CMake/options.cmake b/CMake/options.cmake index 142f345ee..008088a45 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -145,37 +145,63 @@ if (OPTION_BUILD_HTML_DOCUMENTATION OR OPTION_BUILD_PDF_DOCUMENTATION) endif (OPTION_BUILD_HTML_DOCUMENTATION OR OPTION_BUILD_PDF_DOCUMENTATION) ####################################################################### -include (FindPkgConfig) +# Include optional Cairo support +####################################################################### option (OPTION_CAIRO "use lib Cairo" OFF) option (OPTION_CAIROEXT "use FLTK code instrumentation for Cairo extended use" OFF ) -if ((OPTION_CAIRO OR OPTION_CAIROEXT) AND LIB_CAIRO) +set (FLTK_HAVE_CAIRO 0) +set (FLTK_USE_CAIRO 0) + +if (OPTION_CAIRO OR OPTION_CAIROEXT) pkg_search_module (PKG_CAIRO cairo) -endif ((OPTION_CAIRO OR OPTION_CAIROEXT) AND LIB_CAIRO) - -if (PKG_CAIRO_FOUND) - set (FLTK_HAVE_CAIRO 1) - add_subdirectory (cairo) - list (APPEND FLTK_LDLIBS -lcairo -lpixman-1) - include_directories (${PKG_CAIRO_INCLUDE_DIRS}) - string (REPLACE ";" " " CAIROFLAGS "${PKG_CAIRO_CFLAGS}") - - if (LIB_CAIRO AND OPTION_CAIROEXT) - set (FLTK_USE_CAIRO 1) - set (FLTK_CAIRO_FOUND TRUE) + + # fl_debug_var (PKG_CAIRO_FOUND) + + if (PKG_CAIRO_FOUND) + set (FLTK_HAVE_CAIRO 1) + if (OPTION_CAIROEXT) + set (FLTK_USE_CAIRO 1) + endif (OPTION_CAIROEXT) + add_subdirectory (cairo) + + # fl_debug_var (PKG_CAIRO_INCLUDE_DIRS) + # fl_debug_var (PKG_CAIRO_CFLAGS) + # fl_debug_var (PKG_CAIRO_STATIC_CFLAGS) + # fl_debug_var (PKG_CAIRO_LIBRARIES) + # fl_debug_var (PKG_CAIRO_STATIC_LIBRARIES) + + include_directories (${PKG_CAIRO_INCLUDE_DIRS}) + + # Cairo libs and flags for fltk-config + + # Hint: use either PKG_CAIRO_* or PKG_CAIRO_STATIC_* variables to + # create the list of libraries used to link programs with cairo + # by running fltk-config --use-cairo --compile ... + # Currently we're using the non-STATIC variables to link cairo shared. + + set (CAIROLIBS) + foreach (lib ${PKG_CAIRO_LIBRARIES}) + list (APPEND CAIROLIBS "-l${lib}") + endforeach() + + string (REPLACE ";" " " CAIROLIBS "${CAIROLIBS}") + string (REPLACE ";" " " CAIROFLAGS "${PKG_CAIRO_CFLAGS}") + + # fl_debug_var (FLTK_LDLIBS) + # fl_debug_var (CAIROFLAGS) + # fl_debug_var (CAIROLIBS) + else () - set (FLTK_CAIRO_FOUND FALSE) - endif (LIB_CAIRO AND OPTION_CAIROEXT) -else () - if (OPTION_CAIRO OR OPTION_CAIROEXT) message (STATUS "*** Cairo was requested but not found - please check your cairo installation") message (STATUS "*** or disable options OPTION_CAIRO and OPTION_CAIRO_EXT.") message (FATAL_ERROR "*** Terminating: missing Cairo libs or headers.") - endif (OPTION_CAIRO OR OPTION_CAIROEXT) -endif (PKG_CAIRO_FOUND) + endif (PKG_CAIRO_FOUND) + +endif (OPTION_CAIRO OR OPTION_CAIROEXT) ####################################################################### option (OPTION_USE_SVG "read/write SVG files" ON) |
