diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2026-01-29 17:25:24 +0100 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2026-01-29 17:43:21 +0100 |
| commit | e9966b7e3190705b3e9b50d35f6a5aff3fe6443e (patch) | |
| tree | ba1be7d49801515eb8f055b7f13238a32bb92498 /CMake/options.cmake | |
| parent | bed38ba3f5ba653ab41bd5abb92c923591442c8f (diff) | |
CMake: add try_compile() to figure out if Pen/Tablet is supported
This test is specifically intended to disable Pen/Tablet support on
classic MinGW (32-bit) platforms that lack required symbol definitions
although Pen/Tablet support might be supported by the Windows system.
This test can be extended for other platforms, but for now it's
performed only on Windows.
Diffstat (limited to 'CMake/options.cmake')
| -rw-r--r-- | CMake/options.cmake | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/CMake/options.cmake b/CMake/options.cmake index 27cffd038..f005f8b0e 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -491,11 +491,42 @@ else() set(FLTK_HAVE_FORMS 0) endif() +# Note: on some Windows build systems (notably "classic" MinGW 32-bit) +# Pen/Tablet support is not available, hence we use try_compile() to +# figure this out. +# +# CMake variables: +# - FLTK_OPTION_PEN_SUPPORT: user option (cache; default ON/TRUE) +# - PEN_DRIVER_SUPPORTED : Windows only; result of try_compile() +# - FLTK_HAVE_PEN_SUPPORT : final result for building Pen/Tablet support, +# also used to set config variable in config.h + if(FLTK_OPTION_PEN_SUPPORT) - set(FLTK_HAVE_PEN_SUPPORT 1) -else() + if(WIN32) + try_compile(PEN_DRIVER_SUPPORTED + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/CMake/pen-support.c + ) + # fl_debug_var(PEN_DRIVER_SUPPORTED) + if(PEN_DRIVER_SUPPORTED) + set(FLTK_HAVE_PEN_SUPPORT 1) + else() + set(FLTK_HAVE_PEN_SUPPORT 0) + endif() + else(WIN32) # all other platforms + set(FLTK_HAVE_PEN_SUPPORT 1) + endif(WIN32) + + # generate a warning if Pen/Tablet support was requested but can't be compiled + + if(NOT FLTK_HAVE_PEN_SUPPORT) + message(STATUS "WARNING: Pen/Tablet support requested (FLTK_OPTION_PEN_SUPPORT) but not available") + message(STATUS " ... Pen/Tablet support has been disabled!") + endif() + +else(FLTK_OPTION_PEN_SUPPORT) # option disabled by user set(FLTK_HAVE_PEN_SUPPORT 0) -endif() +endif(FLTK_OPTION_PEN_SUPPORT) ####################################################################### if(DOXYGEN_FOUND) |
