FindFLTK¶
Finds the Fast Light Toolkit (FLTK), a cross-platform toolkit for GUI development:
find_package(FLTK [...])
FLTK uses CMake-based build system and provides a package configuration file for
projects to find it. As of its 1.4.0 version it also provides
Imported Targets that encapsulate usage requirements. For example,
fltk::fltk, which can be linked to project targets where FLTK is needed.
This module takes that into account and first attempts to find FLTK in
config mode. If the configuration file is not available, it falls back to
module mode and searches standard locations. See also to the official FLTK
documentation for more information, how to use FLTK with CMake.
Added in version 3.11: Debug and release (optimized) library variants are found separately and use per-configuration variables.
Result Variables¶
This module defines the following variables:
FLTK_FOUNDBoolean indicating whether FLTK was found.
FLTK_LIBRARIESLibraries needed to link against to use FLTK.
FLTK_WRAP_UIBoolean indicating whether the
fluidexecutable is found. This variable is available only if FLTK is found in module mode and can be used, for example, to conditionally invoke thefltk_wrap_ui()command if it is needed and available.
Cache Variables¶
The following cache variables are also available to set or use:
FLTK_FLUID_EXECUTABLEThe path to the
fluidbinary tool.FLTK_INCLUDE_DIRThe include directory containing header files needed to use FLTK.
FLTK_BASE_LIBRARY_RELEASEAdded in version 3.11.
The path to the release (optimized) FLTK base library.
FLTK_BASE_LIBRARY_DEBUGAdded in version 3.11.
The path to the debug FLTK base library.
FLTK_GL_LIBRARY_RELEASEAdded in version 3.11.
The path to the release (optimized) FLTK GL library.
FLTK_GL_LIBRARY_DEBUGAdded in version 3.11.
The path to the debug FLTK GL library.
FLTK_FORMS_LIBRARY_RELEASEAdded in version 3.11.
The path to the release (optimized) FLTK Forms library.
FLTK_FORMS_LIBRARY_DEBUGAdded in version 3.11.
The path to the debug FLTK Forms library.
FLTK_IMAGES_LIBRARY_RELEASEAdded in version 3.11.
The path to the release (optimized) FLTK Images protobuf library.
FLTK_IMAGES_LIBRARY_DEBUGAdded in version 3.11.
The path to the debug FLTK Images library.
Input Variables¶
By default, this module searches for all FLTK libraries and its fluid
executable. The following variables can be set before calling
find_package(FLTK) to indicate which elements are optional for a successful
configuration:
FLTK_SKIP_FLUIDSet to boolean true to mark the
fluidexecutable as optional.FLTK_SKIP_FORMSSet to boolean true to mark the FLTK Forms library as optional; it will therefore not be included in the
FLTK_LIBRARIESresult variable.FLTK_SKIP_IMAGESSet to boolean true to mark the FLTK Image library as optional; it will therefore not be included in the
FLTK_LIBRARIESresult variable.FLTK_SKIP_OPENGLSet to boolean true to mark the FLTK OpenGL library as optional; it will therefore not be included in the
FLTK_LIBRARIESresult variable.
Examples¶
Finding FLTK and conditionally creating a fltk::fltk imported interface
target, if it is not provided by the upstream FLTK package. Imported target can
then be linked to a project target:
find_package(FLTK)
if(FLTK_FOUND AND NOT TARGET fltk::fltk)
add_library(fltk::fltk INTERFACE IMPORTED)
set_target_properties(
fltk::fltk
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${FLTK_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${FLTK_LIBRARIES}"
)
endif()
target_link_libraries(project_target PRIVATE fltk::fltk)