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).
This commit is contained in:
Albrecht Schlosser
2021-10-06 18:17:55 +02:00
parent a6f02f86fa
commit cf20474d7c
+18
View File
@@ -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")