cparse is a small C++20 library distributed as source. There is no pre-built binary release — the code is short enough that building it in place inside your own project is the recommended path. This page covers three integration modes:
- Embedded —
add_subdirectory()from a host CMake project. This is how fson and the FFS server itself consume cparse. - Standalone install — build once, install to a prefix, consume via
pkg-configfrom any other build system. - Conan — for consumers that already use Conan for third-party dependencies.
Prerequisites
- A C++20 compiler. GCC ≥ 12 and Clang ≥ 15 are tested; MSVC is not currently tested but the code uses no compiler-specific extensions.
- CMake ≥ 3.20.
- GoogleTest is used only by the test suite and only in standalone builds — embedded builds do not require it.
There are no other runtime dependencies. The library links against libstdc++ (or your standard library of choice) and nothing else.
Getting the source
Download the latest source archive from the Downloads page. Each release ships as both .tar.gz and .zip, with a matching .sha256 file for verification:
sha256sum -c cparse-1.0.1.tar.gz.sha256
tar xzf cparse-1.0.1.tar.gz
cd cparse-1.0.1
The archive contains only src/, test/, CMakeLists.txt, cparse.pc.in, conanfile.py and LICENSE — the whole tree is under five kilobytes when packed.
Mode 1 — Embedded (add_subdirectory)
Drop the extracted directory into your project tree (typically under libs/external/cparse/ or as a git submodule) and add one line to your CMakeLists.txt:
add_subdirectory(libs/external/cparse)
add_executable(myparser main.cpp)
target_link_libraries(myparser PRIVATE cparse)
In embedded mode, cparse detects it is being included from a parent project (CMAKE_CURRENT_SOURCE_DIR != CMAKE_SOURCE_DIR) and turns off its tests, examples and CPack integration automatically. The host build type is honoured — cparse does not force Debug or Release on you.
You can also override the install component name so cparse's shared library ships as part of your own package:
set(CPARSE_INSTALL_COMPONENT "myapp-runtime" CACHE STRING "")
add_subdirectory(libs/external/cparse)
Mode 2 — Standalone install
Build cparse once, install it into a prefix, and let any consumer find it via pkg-config:
cd cparse-1.0.1
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build build
sudo cmake --install build
The library, headers and a cparse.pc file are installed. From a consumer project:
pkg-config --cflags --libs cparse
# -I/usr/local/include -L/usr/local/lib -lcparse
Or from a consumer CMakeLists.txt:
find_package(PkgConfig REQUIRED)
pkg_check_modules(CPARSE REQUIRED IMPORTED_TARGET cparse)
add_executable(myparser main.cpp)
target_link_libraries(myparser PRIVATE PkgConfig::CPARSE)
Standalone builds also enable the test suite (if GoogleTest is on the CMAKE_PREFIX_PATH) and the CPack targets for TGZ, ZIP, DEB and RPM packages. cpack -G DEB in the build directory produces a .deb; substitute RPM for a .rpm.
Mode 3 — Conan
A recipe is shipped as conanfile.py. In your consumer's conanfile.txt:
[requires]
cparse/1.0.1
[generators]
CMakeDeps
CMakeToolchain
Then in your CMakeLists.txt:
find_package(cparse CONFIG REQUIRED)
target_link_libraries(myparser PRIVATE cparse::cparse)
The recipe honours the standard shared and fPIC options.
Verifying the install
A one-line smoke test — this program should compile, link and exit cleanly:
#include <cparse/Cursor.hh>
int main() { fedem::parser::Cursor c; return 0; }
g++ -std=c++20 smoke.cpp $(pkg-config --cflags --libs cparse) -o smoke
./smoke && echo OK
If that runs, cparse is installed correctly and you can move on to the Getting Started guide.
What is not installed
cparse ships no headers-only façade, no CLI tool, no configuration file, no runtime data. The installation footprint is one shared library, one directory of headers under <prefix>/include/cparse/, and one cparse.pc. Uninstalling is rm on those three paths.

