To streamline finding external tools our build depends on, we provide several
Find Modules in our cmake/
directory which are discoverable by the CMake
find_package command. Encapsulating code for wrangling dependencies in
separate modules makes our CMakeLists.txt
files less cluttered and more
readable, as the find_package interface forces explicit definition of
requirements. Failing to find dependencies can result in portions of our build
being disabled, often testing components.
For example, Clang provides many clang based tools as part of a package, but we
don't require them all. Using a FindClangTools Module lets us select only
the individual tools we need via the COMPONENTS
keyword. The VERSION
keyword can also be used to mandate the version of the tools needed, useful
when we only support fixed versions as part of our build.
.. seealso:: All `Find Modules`_ are implemented using `FindPackageHandleStandardArgs`_
.. cmake-module:: ../../cmake/FindClangTools.cmake
.. cmake-module:: ../../cmake/FindClspv.cmake
.. cmake-module:: ../../cmake/FindGitClangFormat.cmake
.. seealso:: Used to implement the :doc:`/cmake/Format`.
.. cmake-module:: ../../cmake/FindLLVMTool.cmake
.. cmake-module:: ../../cmake/FindLit.cmake
.. cmake-module:: ../../cmake/FindSpirvTools.cmake
Our Find Modules make use of CMake's double colon namespace prefix when
creating component targets, conforming to syntax '<package>::<component>
'.
This is in accordance with policy CMP0028 where CMake will recognize that
values passed to :cmake-command:`target_link_libraries` that contain ::
in
their name are supposed to be Imported Targets rather than just library
names, and will produce appropriate diagnostic messages.