From cf20474d7c13aeeb59f0248e86a26143c500b47c Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Wed, 6 Oct 2021 18:17:55 +0200 Subject: [PATCH] CMake: Simplify adding test programs for developers The intention is to make it more convenient for developers to add one or more test programs for their tests by editing only one variable (extra_tests). --- test/CMakeLists.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 33df73a62..160efe21a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -46,6 +46,15 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) +####################################################################### +# Define additional example programs for testing, for instance: +# set (extra_tests issue-276 str-1895) +# Use the source file test/'name'.cxx for each additional program. +# These test programs will be built with image and GL libraries. +# Leave the variable 'extra_tests' empty to disable extra test programs. + +set (extra_tests) + ####################################################################### # Add the ANDROID_OK option if the example can be compiled for Android # as well as for other platforms. @@ -134,6 +143,15 @@ CREATE_EXAMPLE (valuators valuators.fl fltk) CREATE_EXAMPLE (unittests unittests.cxx fltk) CREATE_EXAMPLE (windowfocus windowfocus.cxx fltk) +# create additional test programs (used by developers for testing) +if (extra_tests) + # message ("") + foreach (name ${extra_tests}) + # message (STATUS "Will build additional test program ${name}") + create_example (${name} ${name}.cxx "fltk_images;fltk_gl;fltk") + endforeach () +endif () + # OpenGL demos... if (OPENGL_FOUND) CREATE_EXAMPLE (CubeView "CubeMain.cxx;CubeView.cxx;CubeViewUI.fl" "fltk_gl;fltk")