โ๏ธ 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.
๐งฉ 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. It ensures that the CrashCatch target INTERFACE
only is available immediatly without installation.
๐ฆ Installing to Your System (Optional)¶
To install CrashCatch to your machine or a custom prefix:
This will generate:
install/
โโโ include/CrashCatch.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: You may optionally add
-rdynamic
or link-ldl
for bettery symbol resolution during stack tracing:
๐งช Example¶
See examples/
folder for fully working sample projects that compile with CMake.