From c92f992380704942825e6dcf4363ea45585ac6cd Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Tue, 12 Feb 2019 15:09:42 +0100 Subject: CMake: Cairo demo must also be built w/o Cairo The Cairo demo program (test/cairo_test.cxx) can and should be built even if Cairo is not configured with CMake as it is done with autotools (configure/make). The message window shown when Cairo support is not available has been improved (is more explicit and has a window title). --- test/CMakeLists.txt | 10 ++++++---- test/cairo_test.cxx | 17 ++++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 18772b1d2..1d1f98dbe 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -124,10 +124,12 @@ CREATE_EXAMPLE(gl_overlay gl_overlay.cxx "fltk;fltk_gl;${OPENGL_LIBRARIES}") CREATE_EXAMPLE(shape shape.cxx "fltk;fltk_gl;${OPENGL_LIBRARIES}") endif(OPENGL_FOUND) -# Cairo demo -if(FLTK_HAVE_CAIRO) - CREATE_EXAMPLE(cairo_test cairo_test.cxx "fltk;fltk_cairo") -endif(FLTK_HAVE_CAIRO) +# Cairo demo - must also be built w/o Cairo (displays a message box) +if (FLTK_HAVE_CAIRO) + CREATE_EXAMPLE(cairo_test cairo_test.cxx "fltk;fltk_cairo") +else () + CREATE_EXAMPLE(cairo_test cairo_test.cxx fltk) +endif (FLTK_HAVE_CAIRO) endif(NOT ANDROID) diff --git a/test/cairo_test.cxx b/test/cairo_test.cxx index 21a812be9..46348f23c 100644 --- a/test/cairo_test.cxx +++ b/test/cairo_test.cxx @@ -1,19 +1,19 @@ // // "$Id$" // -// Arc drawing test program for the Fast Light Tool Kit (FLTK). +// Cairo drawing test program for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2018 by Bill Spitzak and others. +// Copyright 1998-2019 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: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // // Please report all bugs and problems on the following page: // -// http://www.fltk.org/str.php +// https://www.fltk.org/str.php // #include @@ -27,7 +27,7 @@ #include #define DEF_WIDTH 0.03 -// uncomment the following line to enable cairo context autolink feature: +// uncomment the following line to enable Cairo context autolink feature: // #define AUTOLINK // put your drawing stuff here @@ -116,7 +116,7 @@ static void round_button(cairo_t *cr, double x0, double y0, centered_text(cr, x0, y0, rect_width, rect_height, "FLTK loves Cairo!"); } -// The cairo rendering cb called during Fl_Cairo_Window::draw() : +// The Cairo rendering cb called during Fl_Cairo_Window::draw() : static void my_cairo_draw_cb(Fl_Cairo_Window *window, cairo_t *cr) { int w = window->w(), h = window->h(); @@ -147,7 +147,10 @@ int main(int argc, char **argv) { #include int main(int argc, char **argv) { - fl_message("please configure fltk with CAIRO enabled (--enable-cairo or --enable-cairoext)"); + fl_message_title("This program needs a Cairo enabled FLTK library"); + fl_message( + "Please configure FLTK with Cairo enabled (--enable-cairo or --enable-cairoext)\n" + "or one of the CMake options OPTION_CAIRO or OPTION_CAIROEXT, respectively."); return 0; } #endif -- cgit v1.2.3