Fetch the repository at configure time and link one of the two compiled libraries:
FetchContent_Declare(
forkunion
GIT_REPOSITORY https://github.com/ashvardanian/ForkUnion
GIT_TAG v4.0.0-rc.1
)
FetchContent_MakeAvailable(forkunion)
target_link_libraries(your_target PRIVATE forkunion::static) # or forkunion::sharedforkunion::static links the C ABI into your binary, forkunion::shared keeps one copy per process, and forkunion::abi is the C header alone, with nothing to link.
Installing also drops a forkunion.pc, so pkg-config --cflags --libs forkunion works outside CMake.
The archive is C++ behind a C facade, so a C consumer linking it by hand names the C++ runtime itself: -lstdc++ -lpthread, or -lc++ under Apple’s toolchain.