ecm-find-modules (7) Linux Manual Page
ecm-find-modules – ECM Find Modules Reference
Introduction
Find modules are used by the CMake find_package command to search for packages that do not provide their own CMake package config files. CMake provides an extensive set of find modules, and Extra CMake Modules (ECM) adds to that.
To use ECM’s find modules, you need to tell CMake to find the ECM package, and then add either ${ECM_MODULE_PATH} or ${ECM_FIND_MODULE_DIR} to the CMAKE_MODULE_PATH variable:
find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_FIND_MODULE_DIR})
Using ${ECM_MODULE_PATH} will also make the modules intended for direct use by CMake scripts available (see ecm-modules(7) and ecm-kde-modules(7)).
You can also make local copies of find modules using the ecm_use_find_modules function from ECMUseFindModules, which is automatically included when ECM is found:
find_package(ECM REQUIRED NO_MODULE)
ecm_use_find_modules(
DIR "${CMAKE_BINARY_DIR}/cmake"
MODULES FindEGL.cmake
)
set(CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}/cmake")
This allows selective use of ECM’s find modules, and the NO_OVERRIDE argument can be used to ensure that if CMake ships its own version of that find module, it will be used instead.
All Find Modules
FindEGL
Try to find EGL.
This will define the following variables:
EGL_FOUND- True if (the requested version of) EGL is available
EGL_VERSION- The version of EGL; note that this is the API version defined in the headers, rather than the version of the implementation (eg: Mesa)
EGL_LIBRARIES- This can be passed to target_link_libraries() instead of the
EGL::EGLtarget EGL_INCLUDE_DIRS- This should be passed to target_include_directories() if the target is not used for linking
EGL_DEFINITIONS- This should be passed to target_compile_options() if the target is not used for linking
If
EGL_FOUNDis TRUE, it will also define the following imported target: EGL::EGL- The EGL library
In general we recommend using the imported target, as it is easier to use. Bear in mind, however, that if the target is in the link interface of an exported library, it must be made available by the package config file.
Since pre-1.0.0.
FindKF5
Find KDE Frameworks 5 with a single find_package() call.
This will use the package config files provided by the individual frameworks. For example, if you wish to find KArchive, which presents itself to CMake as KF5Archive (ie: you would do find_package(KF5Archive) to find it directly), you can do
find_package(KF5 COMPONENTS Archive)
If all the required components (those given in the COMPONENTS argument, but not those given in the OPTIONAL_COMPONENTS argument) are found, KF5_FOUND will be set to true. Otherwise, it will be set to false.
Since pre-1.0.0.
FindLibGit2
Try to find libgit2 on a Unix system.
This will define the following variables:
LIBGIT2_FOUND- True if (the requested version of) libgit2 is available
LIBGIT2_VERSION- The version of libgit2
LIBGIT2_LIBRARIES- This can be passed to target_link_libraries() instead of the
LibGit2::LibGit2target LIBGIT2_INCLUDE_DIRS- This should be passed to target_include_directories() if the target is not used for linking
LIBGIT2_DEFINITIONS- This should be passed to target_compile_options() if the target is not used for linking
If
LIBGIT2_FOUNDis TRUE, it will also define the following imported target: LibGit2::LibGit2- The libgit2 library
In general we recommend using the imported target, as it is easier to use. Bear in mind, however, that if the target is in the link interface of an exported library, it must be made available by the package config file.
Since 1.3.0.
FindOpenEXR
Try to find the OpenEXR libraries.
This will define the following variables:
OpenEXR_FOUND- True if OpenEXR is available
OpenEXR_LIBRARIES- Link to these to use OpenEXR
OpenEXR_INCLUDE_DIRS- Include directory for OpenEXR
OpenEXR_DEFINITIONS- Compiler flags required to link against OpenEXR
and the following imported targets:
OpenEXR::IlmImf- The OpenEXR core library
In general we recommend using the imported target, as it is easier to use. Bear in mind, however, that if the target is in the link interface of an exported library, it must be made available by the package config file.
Since pre-1.0.0.
FindPng2Ico
Try to find png2ico.
If the png2ico executable is not in your PATH, you can provide an alternative name or full path location with the Png2Ico_EXECUTABLE variable.
This will define the following variables:
Png2Ico_FOUND- True if png2ico is available.
Png2Ico_EXECUTABLE- The png2ico executable.
If
Png2Ico_FOUNDis TRUE, it will also define the following imported target: Png2Ico::Png2Ico- The png2ico executable.
and the following variables:
Png2Ico_HAS_COLORS_ARGUMENT- Whether png2ico accepts a
–colorsargument. Matthias Benkmann’s tool does, while the version of png2ico from the "KDE On Windows" (kdewin) project does not. Png2Ico_HAS_RCFILE_ARGUMENT- Whether png2ico accepts an
–rcfileargument. The version of png2ico from the "KDE On Windows" (kdewin) project does, while Matthias Benkmann’s tool does not.Since 1.7.0.
FindPoppler
Try to find Poppler.
This is a component-based find module, which makes use of the COMPONENTS and OPTIONAL_COMPONENTS arguments to find_module. The following components are available:
Core Cpp Qt5 Qt4 Glib
If no components are specified, this module will act as though all components were passed to OPTIONAL_COMPONENTS.
This module will define the following variables, independently of the components searched for or found:
Poppler_FOUND- TRUE if (the requested version of) Poppler is available
Poppler_VERSION- Found Poppler version
Poppler_TARGETS- A list of all targets imported by this module (note that there may be more than the components that were requested)
Poppler_LIBRARIES- This can be passed to target_link_libraries() instead of the imported targets
Poppler_INCLUDE_DIRS- This should be passed to target_include_directories() if the targets are not used for linking
Poppler_DEFINITIONS- This should be passed to target_compile_options() if the targets are not used for linking
For each searched-for components,
Poppler_<component>_FOUNDwill be set to TRUE if the corresponding Poppler library was found, and FALSE otherwise. IfPoppler_<component>_FOUNDis TRUE, the imported targetPoppler::<component>will be defined. This module will also attempt to determinePoppler_*_VERSIONvariables for each imported target, althoughPoppler_VERSIONshould normally be sufficient.In general we recommend using the imported targets, as they are easier to use and provide more control. Bear in mind, however, that if any target is in the link interface of an exported library, it must be made available by the package config file.
Since 5.19
FindQtWaylandScanner
Try to find qtwaylandscanner.
If the qtwaylandscanner executable is not in your PATH, you can provide an alternative name or full path location with the QtWaylandScanner_EXECUTABLE variable.
This will define the following variables:
QtWaylandScanner_FOUND- True if qtwaylandscanner is available
QtWaylandScanner_EXECUTABLE- The qtwaylandscanner executable.
If
QtWaylandScanner_FOUNDis TRUE, it will also define the following imported target: Wayland::QtScanner- The qtwaylandscanner executable.
This module provides the following functions to generate C++ protocol implementations:
- •
ecm_add_qtwayland_client_protocol- •
ecm_add_qtwayland_server_protocolecm_add_qtwayland_client_protocol(<source_files_var> PROTOCOL <xmlfile> BASENAME <basename> [PREFIX <prefix>])
Generate C++ wrapper to Wayland client protocol files from
<xmlfile>XML definition for the<basename>interface and append those files to<source_files_var>. Pass the<prefix>argument if the interface names don’t start withqt_orwl_.WaylandScanner is required and will be searched for.
ecm_add_qtwayland_server_protocol(<source_files_var> PROTOCOL <xmlfile> BASENAME <basename> [PREFIX <prefix>])
Generate C++ wrapper to Wayland server protocol files from
<xmlfile>XML definition for the<basename>interface and append those files to<source_files_var>. Pass the<prefix>argument if the interface names don’t start withqt_orwl_.WaylandScanner is required and will be searched for.
Since 1.4.0.
FindSharedMimeInfo
Try to find the shared-mime-info package.
This will define the following variables:
SharedMimeInfo_FOUND- True if system has the shared-mime-info package
UPDATE_MIME_DATABASE_EXECUTABLE- The update-mime-database executable
and the following imported targets:
SharedMimeInfo::UpdateMimeDatabase- The update-mime-database executable
The follow macro is available:
update_xdg_mimetypes(<path>)
Updates the XDG mime database at install time (unless the
$DESTDIRenvironment variable is set, in which case it is up to package managers to perform this task).Since pre-1.0.0.
FindWayland
Try to find Wayland.
This is a component-based find module, which makes use of the COMPONENTS and OPTIONAL_COMPONENTS arguments to find_module. The following components are available:
Client Server Cursor Egl
If no components are specified, this module will act as though all components were passed to OPTIONAL_COMPONENTS.
This module will define the following variables, independently of the components searched for or found:
Wayland_FOUND- TRUE if (the requested version of) Wayland is available
Wayland_VERSION- Found Wayland version
Wayland_TARGETS- A list of all targets imported by this module (note that there may be more than the components that were requested)
Wayland_LIBRARIES- This can be passed to target_link_libraries() instead of the imported targets
Wayland_INCLUDE_DIRS- This should be passed to target_include_directories() if the targets are not used for linking
Wayland_DEFINITIONS- This should be passed to target_compile_options() if the targets are not used for linking
For each searched-for components,
Wayland_<component>_FOUNDwill be set to TRUE if the corresponding Wayland library was found, and FALSE otherwise. IfWayland_<component>_FOUNDis TRUE, the imported targetWayland::<component>will be defined. This module will also attempt to determineWayland_*_VERSIONvariables for each imported target, althoughWayland_VERSIONshould normally be sufficient.In general we recommend using the imported targets, as they are easier to use and provide more control. Bear in mind, however, that if any target is in the link interface of an exported library, it must be made available by the package config file.
Since pre-1.0.0.
FindWaylandScanner
Try to find wayland-scanner.
If the wayland-scanner executable is not in your PATH, you can provide an alternative name or full path location with the WaylandScanner_EXECUTABLE variable.
This will define the following variables:
WaylandScanner_FOUND- True if wayland-scanner is available.
WaylandScanner_EXECUTABLE- The wayland-scanner executable.
If
WaylandScanner_FOUNDis TRUE, it will also define the following imported target: Wayland::Scanner- The wayland-scanner executable.
This module provides the following functions to generate C protocol implementations:
- •
ecm_add_wayland_client_protocol- •
ecm_add_wayland_server_protocolecm_add_wayland_client_protocol(<source_files_var> PROTOCOL <xmlfile> BASENAME <basename>)
Generate Wayland client protocol files from
<xmlfile>XML definition for the<basename>interface and append those files to<source_files_var>.ecm_add_wayland_server_protocol(<source_files_var> PROTOCOL <xmlfile> BASENAME <basename>)
Generate Wayland server protocol files from
<xmlfile>XML definition for the<basename>interface and append those files to<source_files_var>.Since 1.4.0.
FindX11_XCB
Try to find the X11 XCB compatibility library.
This will define the following variables:
X11_XCB_FOUND- True if (the requested version of) libX11-xcb is available
X11_XCB_VERSION- The version of libX11-xcb (this is not guaranteed to be set even when X11_XCB_FOUND is true)
X11_XCB_LIBRARIES- This can be passed to target_link_libraries() instead of the
EGL::EGLtarget X11_XCB_INCLUDE_DIR- This should be passed to target_include_directories() if the target is not used for linking
X11_XCB_DEFINITIONS- This should be passed to target_compile_options() if the target is not used for linking
If
X11_XCB_FOUNDis TRUE, it will also define the following imported target: X11::XCB- The X11 XCB compatibility library
In general we recommend using the imported target, as it is easier to use. Bear in mind, however, that if the target is in the link interface of an exported library, it must be made available by the package config file.
Since pre-1.0.0.
FindXCB
Try to find XCB.
This is a component-based find module, which makes use of the COMPONENTS and OPTIONAL_COMPONENTS arguments to find_module. The following components are available:
XCB ATOM AUX COMPOSITE CURSOR DAMAGE DPMS DRI2 DRI3 EVENT EWMH GLX ICCCM IMAGE KEYSYMS PRESENT RANDR RECORD RENDER RENDERUTIL RES SCREENSAVER SHAPE SHM SYNC UTIL XEVIE XF86DRI XFIXES XINERAMA XINPUT XKB XPRINT XTEST XV XVMC
If no components are specified, this module will act as though all components except XINPUT (which is considered unstable) were passed to OPTIONAL_COMPONENTS.
This module will define the following variables, independently of the components searched for or found:
XCB_FOUND- True if (the requestion version of) xcb is available
XCB_VERSION- Found xcb version
XCB_TARGETS- A list of all targets imported by this module (note that there may be more than the components that were requested)
XCB_LIBRARIES- This can be passed to target_link_libraries() instead of the imported targets
XCB_INCLUDE_DIRS- This should be passed to target_include_directories() if the targets are not used for linking
XCB_DEFINITIONS- This should be passed to target_compile_options() if the targets are not used for linking
For each searched-for components,
XCB_<component>_FOUNDwill be set to true if the corresponding xcb library was found, and false otherwise. IfXCB_<component>_FOUNDis true, the imported targetXCB::<component>will be defined. This module will also attempt to determineXCB_*_VERSIONvariables for each imported target, althoughXCB_VERSIONshould normally be sufficient.In general we recommend using the imported targets, as they are easier to use and provide more control. Bear in mind, however, that if any target is in the link interface of an exported library, it must be made available by the package config file.
Since pre-1.0.0.
Copyright
KDE Developers
