Skip to main content

CMake

Dependencies

Install dependencies
sudo apt install cmake clang llvm lcov
note

Ubuntu 23.10 (Mantic Minotaur) ships with a broken lcov package, see this issue. You can install lcov from source or use the version from noble.

note

Ubuntu versions >=24.04 also require libclang-rt-dev.

Install libclang-rt-dev
sudo apt install libclang-rt-dev

Version requirements

note

Running CI Fuzz with LLVM versions <= 16 on Linux can cause fuzzing runs to randomly crash. Have a look at the troubleshooting guide for instructions to fix this issue.

Additional Windows version requirements

  • Visual Studio 2022 >= 17

Make sure to select "Develop Desktop C++ applications" in the Visual Studio Installer and enable the following individual components:

  • "C++ Clang Compiler for Windows"
  • "C++ CMake Tools for Windows"
  • "MSBuild support for LLVM (clang-cl) toolset"

Windows limitations

  • C/C++ projects can't depend on shared libraries
  • No support for continuous code coverage

In order to get font colors and glyphs to render properly install the Windows Terminal from the Microsoft Store and run cifuzz in the Developer PowerShell for VS 2022.

Initialize a project

Initialize CI Fuzz in the root directory of your CMake project with the following command:

cifuzz init

Add the following commands before any add_library or add_executable directives to your top level CMakeLists.txt file:

find_package(cifuzz NO_SYSTEM_ENVIRONMENT_PATH)
enable_fuzz_testing()

Example projects