โ๏ธ CMake Integration¶
CrashCatch supports modern CMake out of the box, with both header-only subdirectory usage and installable package support for larger or multi-project environments. It is also available via vcpkg and Conan.
๐งฉ Using as a Subdirectory¶
If you cloned or copied CrashCatch into your project, add this to your CMakeLists.txt:
add_subdirectory(CrashCatch)
add_executable(MyApp main.cpp)
target_link_libraries(MyApp PRIVATE CrashCatch::CrashCatch)
This method is great for embedded or monorepo-style projects. The CrashCatch INTERFACE target is available immediately without installation.
๐ฆ Installing to Your System (Optional)¶
To install CrashCatch to your machine or a custom prefix:
This will generate:
install/
โโโ include/
โ โโโ CrashCatch.hpp
โ โโโ CrashCatchDLL.hpp
โโโ lib/cmake/CrashCatch/
โโโ CrashCatchConfig.cmake
โโโ CrashCatchTargets.cmake
๐ Using find_package()¶
If you've installed CrashCatch via cmake --install, it can be imported in another project:
find_package(CrashCatch REQUIRED)
add_executable(MyApp main.cpp)
target_link_libraries(MyApp PRIVATE CrashCatch::CrashCatch)
CMake will locate the headers and preconfigured target with no additional setup.
Linux Note: Add
-rdynamicfor better symbol resolution in stack traces:
๐ฆ vcpkg¶
CrashCatch is available as a vcpkg port. If you have vcpkg installed:
Then in your CMakeLists.txt:
find_package(CrashCatch CONFIG REQUIRED)
target_link_libraries(MyApp PRIVATE CrashCatch::CrashCatch)
Pass your vcpkg toolchain file when configuring:
Or use a vcpkg.json manifest in your project root:
๐ Conan¶
CrashCatch is available as a Conan package. Add it to your conanfile.txt:
Then install and configure:
conan install . --output-folder=build --build=missing
cmake .. -DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake
Or in a conanfile.py:
๐งช Example¶
See the examples/ folder for fully working sample projects that compile with CMake.