Find Modules

FindClangFormat

Module Source on GitHub

A CMake find module used to find the ClangFormat code formatter. This module provides access to the clang-format executable via CMake targets and variables. When a version is provided to find_package(), this find-module will also consider version-suffixed clang-format executables. See Examples below.

Clang offers a config-file package, which can be used to locate ClangFormat from CMake. However, this requires having the dev packages of LLVM & Clang installed. Additionally, LLVM often isn’t a dependency of Clang(Format) packages, which are frequently distributed independently.

Cache Variables

ClangFormat_EXECUTABLE

Absolute path to the found clang-format executable, used to minimize repeated searches with repeated find_package(ClangFormat) calls. This value can be queried from the target’s IMPORTED_LOCATION property.

Result Variables

ClangFormat_FOUND

Boolean indicating whether the requested version of clang-format was found.

ClangFormat_VERSION

The found version, where version is in the form <major>.<minor>.<patch>

ClangFormat_VERSION_MAJOR

The found major version

ClangFormat_VERSION_MINOR

The found minor version

ClangFormat_VERSION_PATCH

The found patch version

Imported Targets

clang::format

The clang-format executable, as an imported CMake target. Has the IMPORTED_LOCATION property set.

Examples

find_package(ClangFormat)

jcm_create_clang_format_targets(SOURCE_TARGETS libbbq::libbbq)
# considers executables "clang-format-14.0" and "clang-format-14" before "clang-format"

find_package(ClangFormat 14.0 REQUIRED)

Findliburing

Module Source on GitHub

A CMake find module used to find the installed liburing Linux library. This module provides access to the liburing library via CMake targets and variables. This module does not take the target system (CMAKE_SYSTEM_NAME link) into account. To avoid searching for liburing on non-Linux machines, explicitly wrap the find_package(liburing) call in a condition.

Cache Variables

liburing_INCLUDE_DIR

Absolute path to the found liburing include directory, used to minimize repeated searches with repeated find_package(liburing) calls. This value can be queried from the target’s INTERFACE_INCLUDE_DIRECTORIES property.

liburing_LIBRARY

Absolute path to the found liburing shared/static library, used to minimize repeated searches with repeated find_package(liburing) calls. This value can be queried from the target’s IMPORTED_LOCATION property.

Result Variables

liburing_FOUND

Boolean indicating whether the requested version of liburing was found.

liburing_VERSION

The found liburing library version in the form <major>.<minor>

liburing_VERSION_MAJOR

The found liburing library major version as a single integer

liburing_VERSION_MINOR

The found liburing library minor version as a single integer

Imported Targets

liburing::liburing

The liburing library and usage requirements bundled as a CMake target. Has the INTERFACE_INCLUDE_DIRECTORIES and IMPORTED_LOCATION properties set.

Examples

find_package(liburing REQUIRED)

target_link_libraries(mylib PRIVATE liburing::liburing)
find_package(liburing 2.1...2.11 REQUIRED)

FindSphinx

Module Source on GitHub

A CMake find module used to find the Sphinx documentation generator. Sphinx provides an executable to build documentation, commonly called sphinx-build. This module provides access to it, or similarly named executables, via CMake targets and variables.

Cache Variables

Sphinx_EXECUTABLE

Absolute path to the found sphinx-build executable, used to minimize repeated searches with repeated find_package(Sphinx) calls. This value can be queried from the target’s IMPORTED_LOCATION property.

Result Variables

Sphinx_FOUND

True if the sphinx build executable was found

Sphinx_VERSION

The found sphinx version, where version is in the form <major>.<minor>.<patch>

Sphinx_VERSION_MAJOR

The found sphinx major version

Sphinx_VERSION_MINOR

The found sphinx minor version

Sphinx_VERSION_PATCH

The found sphinx patch version

Imported Targets

Sphinx::build

The sphinx build executable (sphinx-build, sphinx-build2, sphinx-build3)

Examples

find_package(Sphinx REQUIRED)

jcm_create_sphinx_targets(CONFIGURE_CONF_PY)

Findvcpkg

Module Source on GitHub

A CMake find module used to find the installed vcpkg package manager executable, the vcpkg-tool. A vcpkg installation contains the pacakge index, in the form of a git repository, and the actual vcpkg-tool, which is primarily an executable to interact with packages. This module provides access to the vcpkg executable via CMake targets and variables.

Cache Variables

vcpkg_EXECUTABLE

Absolute path to the found vcpkg executable, used to minimize repeated searches with repeated find_package(vcpkg) calls. This value can be queried from the target’s IMPORTED_LOCATION property.

Result Variables

vcpkg_FOUND

Boolean indicating whether the requested version of vcpkg was found.

vcpkg_VERSION

The found vcpkg executable version in the form <year>-<month>-<day>-<hash>, which is composed of the date and commit hash of the vcpkg-tool build.

Imported Targets

vcpkg::tool

The vcpkg executable and usage requirements bundled as a CMake target. Has the IMPORTED_LOCATION property set to the full executable path.

Examples

find_package(vcpkg REQUIRED)

add_custom_target(show-installed
  COMMAND vcpkg::tool search
  COMMENT "List installed vcpkg packages"
  USES_TERMINAL)

Where vcpkg’s version does not comply with find_package()’s accepted version format (major[.minor[.patch[.tweak]]]), a specific version CANNOT be provided:

# invalid
find_package(vcpkg 2025-07-21-d4b65a2b83ae6c3526acd1c6f3b51aff2a884533)