ECM-FIND-MODULES(7)
β¨ NAME β¨
ecm-find-modules β the ECM Find Modules Reference, bestie. It lives in the Extra CMake Modules (ECM) manual, and today we're going through every single find module in it, no skips, no cap π
πΈ INTRODUCTION πΈ
okay so. Find modules are the little helpers that CMake's find_package command uses to go hunting for packages that don't ship their own CMake package config files. CMake already comes with a whole buffet of find modules, and Extra CMake Modules (ECM) just adds more on top π
To use ECM's find modules, you gotta tell CMake to find the ECM package first, 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})
Heads up: if you use ${ECM_MODULE_PATH} instead, you also make the modules that are meant 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 gets 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 is the move when you want selective use of ECM's find modules π and the NO_OVERRIDE argument is there so that if CMake ships its own version of that find module, CMake's version gets used instead π«Ά
π ALL FIND MODULES π
β Find7Zip
Try to find 7-Zip, bestie ποΈ
If the 7-Zip executable is not in your PATH, you can provide an alternative name or a full path location with the 7Zip_EXECUTABLE variable.
This will define the following variables:
7Zip_FOUNDβTRUEif 7-Zip is available7Zip_EXECUTABLEβ path to the 7-Zip executable
If 7Zip_FOUND is TRUE, it will also define the following imported target:
7Zip::7Zipβ path to the 7-Zip executable
Note: it will see to only find the original 7-Zip, not one of the p7zip forks π
Since 5.113.0.
β Find7z
Try to find 7z ποΈ
If the 7z executable is not in your PATH, you can provide an alternative name or a full path location with the 7z_EXECUTABLE variable.
This will define the following variables:
7z_FOUNDβTRUEif 7z is available7z_EXECUTABLEβ path to the 7z executable
If 7z_FOUND is TRUE, it will also define the following imported target:
7z::7zβ path to the 7z executable
Note: only works on Windows π
Deprecated: since 5.113, use Find7Zip.
Since 5.85.0.
β FindCanberra
Try to find the Canberra event sound library πβ¨
This will define the following variables:
Canberra_FOUNDβ true if (the requested version of) Canberra is availableCanberra_VERSIONβ the version of CanberraCanberra_LIBRARIESβ the libraries of Canberra, for use withtarget_link_libraries()Canberra_INCLUDE_DIRSβ the include dirs of Canberra, for use withtarget_include_directories()
If Canberra_FOUND is TRUE, it will also define the following imported target:
Canberra::Canberraβ the Canberra library
In general we recommend using the imported target, because it's 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. (yeah, that part matters, don't skip it)
Since 5.56.0.
β FindEGL
Try to find EGL π¨
This will define the following variables:
EGL_FOUNDβ true if (the requested version of) EGL is availableEGL_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) β very much not the same thing, iykykEGL_LIBRARIESβ this can be passed totarget_link_libraries()instead of theEGL::EGLtargetEGL_INCLUDE_DIRSβ this should be passed totarget_include_directories()if the target is not used for linkingEGL_DEFINITIONSβ this should be passed totarget_compile_options()if the target is not used for linking
If EGL_FOUND is 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.
β FindFFmpeg
Try to find FFmpeg components π¬
The following components are available:
AVCODEC AVFILTER AVDEVICE AVFORMAT
AVUTIL SWRESAMPLE SWSCALE POSTPROCESS
If no components are specified in the find_module call, the following ones will be chosen as default:
AVFORMAT AVUTIL AVCODEC
π¦ Imported Targets
This module provides the following imported targets, if found:
FFmpeg::FFmpegβ for all the required FFmpeg componentsFFmpeg::<component>β for each <component> that was found
π¦ Result Variables
This will define the following variables:
FFMPEG_FOUNDβ system has all the required components.FFMPEG_INCLUDE_DIRSβ include directory necessary for using the required components headers.FFMPEG_LIBRARIESβ link these to use the required FFmpeg components.FFMPEG_DEFINITIONSβ compiler switches required for using the required FFmpeg components.
Additionally, for each of the components, the following variables will be defined:
<component>_FOUNDβ true if (the requested version of) <component> is available<component>_INCLUDE_DIRSβ include directory necessary for using the <component> headers<component>_LIBRARIESβ link these to use <component><component>_DEFINITIONSβ compiler switches required for using <component><component>_VERSIONβ the component's version (NOTE: always empty on Windows)
Since the versions of the various FFmpeg components differ for a given release, and CMake supports only one common version for all components, use the following to specify required versions for multiple components:
find_package(FFmpeg 57.48 COMPONENTS AVCODEC)
find_package(FFmpeg 57.40 COMPONENTS AVFORMAT)
find_package(FFmpeg 55.27 COMPONENTS AVUTIL)
NOTE: version checking is skipped on Windows π
Since 6.20.0.
β FindGLIB2
Try to locate the GLib2 library π§΅ If found, this will define the following variables:
GLIB2_FOUNDβ true if the GLib2 library is availableGLIB2_INCLUDE_DIRSβ the GLib2 include directoriesGLIB2_LIBRARIESβ the GLib2 libraries for linkingGLIB2_INCLUDE_DIRβ deprecated, useGLIB2_INCLUDE_DIRSGLIB2_LIBRARYβ deprecated, useGLIB2_LIBRARIES
If GLIB2_FOUND is TRUE, it will also define the following imported targets:
GLIB2::GLIB2β the GLIB2 libraryGLIB2::GTHREAD2β the GThread2 library (since 6.7.0)GLIB2::GOBJECTβ the GObject library (since 6.7.0)GLIB2::GIOβ the GIO library (since 6.7.0)
Since 5.41.0.
β FindGperf
Try to find GNU gperf π§
If the gperf executable is not in your PATH, you can provide an alternative name or a full path location with the Gperf_EXECUTABLE variable.
This will define the following variables:
Gperf_FOUNDβ true if gperf is available.Gperf_EXECUTABLEβ the gperf executable.Gperf_VERSIONβ the gperf version. (since 5.85)
If Gperf_FOUND is TRUE, it will also define the following imported target:
GPerf::Gperfβ the gperf executable.
and the following public function:
ecm_gperf_generate(<GperfInput> <OutputFile> <OutputVariable(|target (since 5.83))>
[GENERATION_FLAGS <flags>])
Run gperf on <GperfInput> to generate <OutputFile>, adding it to the <OutputVariable> variable, which contains the source for the target where <OutputFile> is going to be built or β since KF 5.83 β if the given argument is a target, to the list of private sources of that target. π― The target must not be an alias. The optional GENERATION_FLAGS argument is needed to pass extra parameters to gperf (note: you cannot override the output file that way, so don't even try π
).
A simple invocation would be:
ecm_gperf_generate(simple.gperf ${CMAKE_CURRENT_BINARY_DIR}/simple.h MySources)
Since 5.35.0.
β FindGradle
Gives you the ability to build Android AAR libraries using Gradle π€π±
This relies on the Qt-provided Gradle, so a Qt for Android installation is required. (yes, required, not optional, sorry bestie)
gradle_add_aar(<target>
BUIDLFILE build.gradle
NAME <aar-name>)
This builds an Android AAR library using the given build.gradle file.
gradle_install_aar(<target>
DESTINATION <dest>)
Installs an Android AAR library that has been created with gradle_add_aar.
Since 5.76.0.
β FindIcoTool
Try to find icotool πΌοΈ
If the icotool executable is not in your PATH, you can provide an alternative name or a full path location with the IcoTool_EXECUTABLE variable.
This will define the following variables:
IcoTool_FOUNDβ true if icotool is available.IcoTool_EXECUTABLEβ the icotool executable.
If IcoTool_FOUND is TRUE, it will also define the following imported target:
IcoTool::IcoToolβ the icotool executable.
Since 5.49.
β FindInotify
Try to find inotify on this system π This finds:
libinotifyon Unix-like systems, or- the kernel's inotify.
This will define the following variables:
Inotify_FOUNDβ true if inotify is availableInotify_LIBRARIESβ this has to be passed totarget_link_libraries()Inotify_INCLUDE_DIRSβ this has to be passed totarget_include_directories()
On some platforms like Linux and SunOS, the libraries and include directories are empty, even though Inotify_FOUND may be set to TRUE. That's not a bug, bestie β it's because no special includes or libraries are needed π On other systems these may be needed to use inotify.
Since 5.32.0.
β FindIsoCodes
Try to find iso-codes data files π Once done, this will define:
IsoCodes_FOUNDβ whether the system hasiso-codesIsoCodes_PREFIXβ the location in which theiso-codesdata files are foundIsoCodes_DOMAINSβ the available domains provided byiso-codes
Since 5.80.0.
β FindKF5
Find KDE Frameworks 5 with a single find_package() call π one call, that's it, iconic
...and it's pulling straight from the package config files that each individual framework ships. Real talk: say you wanna find KArchive, which shows up to CMake as KF5Archive (like, you'd do find_package(KF5Archive) to get it directly) β then you do:
find_package(KF5 COMPONENTS Archive)
If all the required components get found (the ones you listed in COMPONENTS, not the ones in OPTIONAL_COMPONENTS), KF5_FOUND gets set to true. Otherwise it's false. Simple as that, bestie. β¨
Since pre-1.0.0.
FindKF6
Find KDE Frameworks 6 in one single find_package() call. One call! Not forty! We love efficiency. π
Same deal as above β it uses the package config files that the individual frameworks hand over. Example time: wanna find KArchive, which presents itself to CMake as KF6Archive (ie: you'd do find_package(KF6Archive) to find it directly)? Then:
find_package(KF6 COMPONENTS Archive)
If all the required components (the COMPONENTS ones, not the OPTIONAL_COMPONENTS ones) are found, KF6_FOUND is true. Otherwise false. No cap.
Since 6.0.0.
FindLibExiv2
Tryna find the Exiv2 library? Say less. π
This defines these variables for you:
LibExiv2_FOUNDβ True if (the requested version of) Exiv2 is availableLibExiv2_VERSIONβ the version of Exiv2LibExiv2_INCLUDE_DIRSβ the include dirs of Exiv2, for use withtarget_include_directories()LibExiv2_LIBRARIESβ the Exiv2 library, for use withtarget_link_libraries(). This can be passed totarget_link_libraries()instead of theLibExiv2::LibExiv2target
And if LibExiv2_FOUND is TRUE, it also defines this imported target:
LibExiv2::LibExiv2β the Exiv2 library
In general we recommend using the imported target, because it's easier to use. But bear in mind: if the target is in the link interface of an exported library, it must be made available by the package config file. That's the fine print, don't skip it π
Since 5.53.0.
FindLibGit2
Tryna find libgit2 on a Unix system? This is your girl. π¦
Variables it defines:
LIBGIT2_FOUNDβ True if (the requested version of) libgit2 is availableLIBGIT2_VERSIONβ the version of libgit2LIBGIT2_LIBRARIESβ this can be passed totarget_link_libraries()instead of theLibGit2::LibGit2targetLIBGIT2_INCLUDE_DIRSβ this should be passed totarget_include_directories()if the target isn't used for linkingLIBGIT2_DEFINITIONSβ this should be passed totarget_compile_options()if the target isn't used for linking
If LIBGIT2_FOUND is TRUE, you also get this imported target:
LibGit2::LibGit2β the libgit2 library
Recommendation, same as ever: use the imported target, it's easier. But fr fr, if the target is in the link interface of an exported library, the package config file has to make it available.
Since 1.3.0.
FindLibMount
Tryna find the libmount library (that's the one that lives inside util-linux)? Once it's done, you get:
LibMount_FOUNDβ LibMount was found on the systemLibMount_INCLUDE_DIRSβ the libmount include directoryLibMount_LIBRARIESβ the libmount librariesLibMount_VERSIONβ the libmount version
And if LibMount_FOUND is TRUE, it also defines this imported target:
LibMount::LibMountβ the libmount library
Since 5.83.0
FindLibcap
Tryna find the setcap binary and the cap libraries? Two for one, iconic. π
This defines:
Libcap_FOUNDβ system has the cap library andsetcapbinaryLibcap_LIBRARIESβ cap libraries to link againstSETCAP_EXECUTABLEβ path of thesetcapbinary
In addition, the following targets are defined:
Libcap::SetCapabilities
Since 5.80.0.
FindOpenEXR
Tryna find the OpenEXR libraries? Here's what you get:
OpenEXR_FOUNDβ True if OpenEXR is availableOpenEXR_LIBRARIESβ link to these to use OpenEXROpenEXR_INCLUDE_DIRSβ include directory for OpenEXROpenEXR_DEFINITIONSβ compiler flags required to link against OpenEXR
Plus these 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.
FindPhoneNumber
Tryna find PhoneNumber? πΈ
This is a component-based find module β it uses the COMPONENTS and OPTIONAL_COMPONENTS arguments to find_module. These are the components you can ask for:
PhoneNumber GeoCoding
If you specify no components at all, this module acts like all of them were passed to OPTIONAL_COMPONENTS. Chill of it, honestly.
It defines this variable no matter which components you searched for or found:
PhoneNumber_FOUNDβ True if (the requestion version of) PhoneNumber is available
(yes, the manpage really says "requestion" π we're leaving it, it's part of the lore now)
For each searched-for component, PhoneNumber_<component>_FOUND gets set to TRUE if the corresponding library was found, and FALSE otherwise. And if PhoneNumber_<component>_FOUND is TRUE, the imported target PhoneNumber::<component> gets defined. Periodt.
Since 5.54.0.
FindPoppler
Tryna find Poppler? Another component-based one, same deal β it uses the COMPONENTS and OPTIONAL_COMPONENTS arguments to find_module. The available components:
Core Cpp Qt5 Qt4 Glib
No components specified? Then this module acts like all of them went to OPTIONAL_COMPONENTS. π«Ά
These variables get defined regardless of which components you searched for or found:
Poppler_FOUNDβ TRUE if (the requested version of) Poppler is availablePoppler_VERSIONβ found Poppler versionPoppler_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 totarget_link_libraries()instead of the imported targetsPoppler_INCLUDE_DIRSβ this should be passed totarget_include_directories()if the targets are not used for linkingPoppler_DEFINITIONSβ this should be passed totarget_compile_options()if the targets are not used for linking
For each searched-for component, Poppler_<component>_FOUND gets set to TRUE if the corresponding Poppler library was found, FALSE otherwise. If Poppler_<component>_FOUND is TRUE, the imported target Poppler::<component> gets defined. This module also attempts to figure out Poppler_*_VERSION variables for each imported target β though Poppler_VERSION should normally be enough for you. β¨
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
FindPulseAudio
Tryna locate the PulseAudio library? π₯ If it's found, these variables get defined:
PulseAudio_FOUNDβ True if the system has the PulseAudio library of at least the minimum version specified by either the version parameter tofind_package()or the variablePulseAudio_MINIMUM_VERSIONPulseAudio_INCLUDE_DIRSβ the PulseAudio include directoryPulseAudio_LIBRARIESβ the PulseAudio libraries for linkingPulseAudio_MAINLOOP_LIBRARYβ the libraries needed to use PulseAudio MainloopPulseAudio_VERSIONβ the version of PulseAudio that was foundPulseAudio_INCLUDE_DIRβ deprecated, usePulseAudio_INCLUDE_DIRSPulseAudio_LIBRARYβ deprecated, usePulseAudio_LIBRARIES
Those last two are deprecated, okay? Don't be out here using them in fresh code, bestie. Use the plural ones. π
If PulseAudio_FOUND is TRUE, it also defines this imported target:
PulseAudio::PulseAudioβ the PulseAudio library
Since 5.41.0.
FindQtWaylandScanner
Tryna find qtwaylandscanner? π§
If the qtwaylandscanner executable isn't in your PATH, you can hand over an alternative name or a full path location with the QtWaylandScanner_EXECUTABLE variable. You're welcome.
This defines:
QtWaylandScanner_FOUNDβ True ifqtwaylandscanneris availableQtWaylandScanner_EXECUTABLEβ theqtwaylandscannerexecutable
And if QtWaylandScanner_FOUND is TRUE, it also defines this imported target:
Wayland::QtScannerβ theqtwaylandscannerexecutable
This module also provides the following functions to generate C++ protocol implementations:
ecm_add_qtwayland_client_protocolecm_add_qtwayland_server_protocol
Here's the client one:
ecm_add_qtwayland_client_protocol(<target>
PROTOCOL <xmlfile>
BASENAME <basename>
[PREFIX <prefix>]
[PRIVATE_CODE])
ecm_add_qtwayland_client_protocol(<source_files_var>
PROTOCOL <xmlfile>
BASENAME <basename>
[PREFIX <prefix>]
[PRIVATE_CODE])
It generates a C++ wrapper for Wayland client protocol files from the <xmlfile> XML definition for the <basename> interface, and appends those files to <source_files_var> or <target>. Pass the <prefix> argument if the interface names don't start with qt_ or wl_. PRIVATE_CODE instructs wayland-scanner to hide marshalling code from the compiled DSO, for use in other DSOs. The default is to export this code. π
WaylandScanner is required and will be searched for.
And the server one:
ecm_add_qtwayland_server_protocol(<target>
PROTOCOL <xmlfile>
BASENAME <basename>
[PREFIX <prefix>]
[PRIVATE_CODE])
ecm_add_qtwayland_server_protocol(<source_files_var>
PROTOCOL <xmlfile>
BASENAME <basename>
[PREFIX <prefix>]
[PRIVATE_CODE])
...so yeah, it generates those wrapper files from the <xmlfile> XML definition for the <basename> interface, then appends them to <source_files_var> or <target>. And bestie, if your interface names don't start with qt_ or wl_, you have to pass the <prefix> argument, okay? π«Ά
PRIVATE_CODE tells wayland-scanner to hide the marshalling code from the compiled DSO so it can be used in other DSOs. The default is to export this code. (yes, default = out in the open β¨)
WaylandScanner is required and will be searched for.
Since 1.4.0.
πΈ FindSasl2 πΈ
Trying to hunt down the SASL2 library, bestie. π
It'll define these variables for you:
Sasl2_FOUNDβ the system has SASL2. slay.Sasl2_VERSIONβ which version of SASL2 you got.Sasl2_INCLUDE_DIRSβ pass this totarget_include_directories()if you're not using the target for linking.Sasl2_LIBRARIESβ the actual SASL2 library. You can pass this totarget_link_libraries()instead of theSasl2::Sasl2target, iykyk.
And if Sasl2_FOUND is TRUE, you also get this imported target:
Sasl2::Sasl2β the SASL2 library, iconic.
Since 5.41.0.
π‘οΈ FindSeccomp π‘οΈ
Trying to locate the libseccomp library.
Defines these:
Seccomp_FOUNDβ true if the seccomp library is available.Seccomp_INCLUDE_DIRSβ the seccomp include directories.Seccomp_LIBRARIESβ the seccomp libraries for linking.
If Seccomp_FOUND is TRUE, it also defines this imported target:
Seccomp::Seccompβ the Seccomp library π
Since 5.44.0.
π FindSharedMimeInfo π
Trying to find the shared-mime-info package.
Variables it defines:
SharedMimeInfo_FOUNDβ true if the system has theshared-mime-infopackage.UPDATE_MIME_DATABASE_EXECUTABLEβ theupdate-mime-databaseexecutable.
Plus these imported targets:
SharedMimeInfo::UpdateMimeDatabaseβ theupdate-mime-databaseexecutable.
And there's this macro available:
update_xdg_mimetypes(<path>)
It updates the XDG mime database at install time β unless the $DESTDIR environment variable is set, in which case it's up to package managers to do that task. not us, not today π
Since pre-1.0.0.
π΅ FindTaglib π΅
Trying to find the Taglib library.
Defines:
Taglib_FOUNDβ true if the system has the taglib library of at least the minimum version specified by the version parameter tofind_package().Taglib_INCLUDE_DIRSβ the taglib include dirs, for use withtarget_include_directories.Taglib_LIBRARIESβ the taglib libraries, for use withtarget_link_libraries().Taglib_VERSIONβ the version of taglib that was found.
If Taglib_FOUND is TRUE, you also get this imported target:
Taglib::Taglibβ the Taglib library β¨
Since 5.72.0
π FindUDev π
Trying to find the UDev library.
Defines:
UDev_FOUNDβ system has UDev.UDev_INCLUDE_DIRSβ the libudev include directory.UDev_LIBRARIESβ the libudev libraries.UDev_VERSIONβ the libudev version.
If UDev_FOUND is TRUE, it also defines this imported target:
UDev::UDevβ the UDev library π
Since 5.57.0.
πͺ FindWayland πͺ
Trying to find Wayland.
Okay so this one is a component-based find module β it uses the COMPONENTS and OPTIONAL_COMPONENTS arguments to find_module. These are the components available:
Client Server Cursor Egl
If you don't specify any components, this module acts like you passed all of them to OPTIONAL_COMPONENTS. (generous queen π)
It defines these variables no matter which components you searched for or found:
Wayland_FOUNDβTRUEif (the requested version of) Wayland is available.Wayland_VERSIONβ found Wayland version.Wayland_TARGETSβ a list of all targets imported by this module. Heads up: there may be more than the components you actually requested πWayland_LIBRARIESβ pass this totarget_link_libraries()instead of the imported targets.Wayland_INCLUDE_DIRSβ pass this totarget_include_directories()if the targets aren't used for linking.Wayland_DEFINITIONSβ pass this totarget_compile_options()if the targets aren't used for linking.Wayland_DATADIRβ the core wayland protocols data directory. Since 5.73.0.
For every component you searched for, Wayland_<component>_FOUND gets set to TRUE if the matching Wayland library was found, and FALSE if it wasn't. If Wayland_<component>_FOUND is TRUE, the imported target Wayland::<component> gets defined. This module will also try to figure out Wayland_*_VERSION variables for each imported target, though Wayland_VERSION should normally be enough for you, fr fr.
In general we recommend using the imported targets β they're easier to use and give you more control π«Ά But like, bear in mind: if any target is in the link interface of an exported library, it must be made available by the package config file. no exceptions, bestie.
Since pre-1.0.0.
π FindWaylandProtocols π
Trying to find wayland-protocols on a Unix system.
Defines:
WaylandProtocols_FOUNDβ true if (the requested version of)wayland-protocolsis available.WaylandProtocols_VERSIONβ the version ofwayland-protocols.WaylandProtocols_DATADIRβ the wayland protocols data directory.
π§ FindWaylandScanner π§
Trying to find wayland-scanner.
If the wayland-scanner executable isn't in your PATH, you can hand over an alternative name or a full path location with the WaylandScanner_EXECUTABLE variable. problem solved π
Defines:
WaylandScanner_FOUNDβ true ifwayland-scanneris available.WaylandScanner_EXECUTABLEβ thewayland-scannerexecutable.
If WaylandScanner_FOUND is TRUE, it also defines this imported target:
Wayland::Scannerβ thewayland-scannerexecutable.
This module also provides these functions for generating C protocol implementations:
ecm_add_wayland_client_protocolecm_add_wayland_server_protocol
ecm_add_wayland_client_protocol(<target>
PROTOCOL <xmlfile>
BASENAME <basename>
[PRIVATE_CODE])
ecm_add_wayland_client_protocol(<source_files_var>
PROTOCOL <xmlfile>
BASENAME <basename>
[PRIVATE_CODE])
Generates Wayland client protocol files from the <xmlfile> XML definition for the <basename> interface, then appends those files to <source_files_var> or <target>.
PRIVATE_CODE tells wayland-scanner to hide the marshalling code from the compiled DSO so it can be used in other DSOs. The default is to export this code.
ecm_add_wayland_server_protocol(<target>
PROTOCOL <xmlfile>
BASENAME <basename>
[PRIVATE_CODE])
ecm_add_wayland_server_protocol(<source_files_var>
PROTOCOL <xmlfile>
BASENAME <basename>
[PRIVATE_CODE])
Generates Wayland server protocol files from the <xmlfile> XML definition for the <basename> interface, then appends those files to <source_files_var> or <target>.
PRIVATE_CODE tells wayland-scanner to hide the marshalling code from the compiled DSO so it can be used in other DSOs. The default is to export this code.
Since 1.4.0.
π FindX11_XCB π
Trying to find the X11 XCB compatibility library.
Defines:
X11_XCB_FOUNDβ true if (the requested version of)libX11-xcbis available.X11_XCB_VERSIONβ the version oflibX11-xcb. Ngl, this one is not guaranteed to be set even whenX11_XCB_FOUNDis true πX11_XCB_LIBRARIESβ pass this totarget_link_libraries()instead of theEGL::EGLtarget. (yes, the page really saysEGL::EGLhere, we don't make the rules π)X11_XCB_INCLUDE_DIRβ pass this totarget_include_directories()if the target isn't used for linking.X11_XCB_DEFINITIONSβ pass this totarget_compile_options()if the target isn't used for linking.
If X11_XCB_FOUND is TRUE, it also defines this imported target:
X11::XCBβ the X11 XCB compatibility library β¨
In general we recommend using the imported target, it's easier to use. But bear in mind: 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 π₯
Trying to find XCB.
Another component-based find module β uses the COMPONENTS and OPTIONAL_COMPONENTS arguments to find_module. Here's the full menu of components:
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
XF86DRI XFIXES XINERAMA XINPUT XKB
XTEST XV XVMC
If you don't specify any components, this module acts like all of them were passed to OPTIONAL_COMPONENTS. But heads up: before 5.82 that excluded XINPUT. Since 5.82, all components are searched for. glow-up π
It defines these variables no matter which components you searched for or found:
XCB_FOUNDβ true if (the "requestion" version of) xcb is available. not me quoting the typo directly, but it's literally what the page says, iconique πXCB_VERSIONβ found xcb version.XCB_TARGETSβ a list of all targets imported by this module. Again: there may be more than the components you requested πXCB_LIBRARIESβ pass this totarget_link_libraries()instead of the imported targets.XCB_INCLUDE_DIRSβ pass this totarget_include_directories()if the targets aren't used for linking.XCB_DEFINITIONSβ pass this totarget_compile_options()if the targets aren't used for linking.
For each component you searched for, XCB_<component>_FOUND gets set to true if the corresponding xcb library was found, and false if it wasn't. If XCB_<component>_FOUND is true, the imported target XCB::<component> gets defined. This module will also try to determine XCB_*_VERSION variables for each imported target, although XCB_VERSION should normally be sufficient. bestie, just use XCB_VERSION π«Ά
okay so general rule, bestie: use the imported targets β they're easier to use and give you way more control. π
but lowkey remember: if any target is in the link interface of an exported library, it must be made available by the package config file. no skipping that, fr fr.
Since pre-1.0.0.
π§ͺ Findepoxy π§ͺ
Trying to find libepoxy on a Unix system? This module is literally here for that. π§β¨
This will define the following variables:
epoxy_FOUNDβ True if (the requested version of)libepoxyis available πepoxy_VERSIONβ The version oflibepoxyepoxy_LIBRARIESβ This should be passed totarget_link_libraries()if the target is not used for linkingepoxy_INCLUDE_DIRSβ This should be passed totarget_include_directories()if the target is not used for linkingepoxy_DEFINITIONSβ This should be passed totarget_compile_options()if the target is not used for linkingepoxy_HAS_GLXβ True if GLX support is available π
If epoxy_FOUND is TRUE, it will also define the following imported target:
epoxy::epoxyβ The epoxy 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.
π Findgzip π
Try to find gzip β that's the whole assignment, bestie. π«Ά
If the gzip executable is not in your PATH, you can provide an alternative name or full path location with the gzip_EXECUTABLE variable.
This will define the following variables:
gzip_FOUNDβTRUEifgzipis available β¨gzip_EXECUTABLEβ Path togzipexecutable
If gzip_FOUND is TRUE, it will also define the following imported target:
gzip::gzipβ Path togzipexecutable π
Since 5.85.0.
π SEE ALSO π
π Copyright π
KDE Developers
that's the teaaa π
β this ECM-FIND-MODULES(7) page is version 6.31, dated Oct 11, 2026, copyright KDE Developers. byeee, go find those modules! π«Άβ¨π
π¦ where this page comes from
- arch rolling: extra-cmake-modules 6.31.0-1 Β· LGPL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms