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:

  1. Embedded — add_subdirectory() from a host CMake project. This is how fson and the FFS server itself consume cparse.
  2. Standalone install — build once, install to a prefix, consume via pkg-config from any other build system.
  3. 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.2.0.0.tar.gz.sha256
tar xzf cparse-1.2.0.0.tar.gz
cd cparse-1.2.0.0

The archive contains src/, examples/, the CMake and Conan build files (CMakeLists.txt, CMakePresets.json, cparse.pc.in, conanfile.py), the Doxygen input (Doxyfile.in) and LICENSE/CONTRIBUTING.md/TRADEMARKS.md — about 30 KB packed. test/ is not part of the release archive; clone the repository instead if you want to build and run the test suite yourself.

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.2.0.0
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, but cparse is not on ConanCenter or any other remote — create the package from the extracted archive first:

conan create cparse-1.2.0.0

Then in your consumer's conanfile.txt:

[requires]
cparse/[>=1.0 <2]

[generators]
CMakeDeps
CMakeToolchain

[layout]
cmake_layout

[layout] matters: without it conan install . scatters its generator files into your project root instead of build/<config>/. Then in your CMakeLists.txt:

find_package(cparse CONFIG REQUIRED)
target_link_libraries(myparser PRIVATE cparse::cparse)

The recipe's options are fPIC, with_tests and with_docs — the package itself is always built as a shared library (package_type is fixed, there is no shared option to toggle).

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.