fson is a small C++ library. Your code links two shared libraries — libfson and its parsing core libcparse — because the public fson headers expose a few cparse types (fedem::parser::ParseError). The bundled fson-check tool ships alongside them; see Tools.

Prerequisites

  • CMake ≥ 3.20 and a C++23 compiler (GCC 12+). The installed public API only requires C++17 from your side.
  • cparse — the parsing core. Since the Conan migration it is a separate Conan package (cparse/[>=1.0 <2]), no longer a git submodule.
  • GoogleTest — optional, only for the test targets.

Build from source

git clone <repository-url> fson
cd fson
cmake -B build
cmake --build build
ctest --test-dir build        # optional, needs GoogleTest
cmake --install build         # libraries, headers, fson.pc, fson-check

cmake --install lays down:

ComponentContents
Runtimelibfson.so.*, libcparse.so.*, fson-check, shell completion
DEVELOPMENTheaders under include/fson/ + include/cparse/, .so namelinks, fson.pc (depends on Runtime)

Conan

The repository is a Conan recipe. set_version() reads the single project(... VERSION x.y.z.w) line in CMakeLists.txt, so the package version always matches the source.

conan create ~/path/to/fson -s build_type=Release
# options: -o "&:with_tools=True"  (fson-check, default on)
#          -o "&:with_tests=False" (skip GoogleTest)
#          -o "&:with_docs=True"   (also build the Doxygen tree — see /api)

Then in your own recipe:

def requirements(self):
    self.requires("fson/[>=0.12 <1]")
find_package(fson CONFIG REQUIRED)
target_link_libraries(app PRIVATE fson::fson)   # brings cparse::cparse along

pkg-config

The installed fson.pc carries both libraries in Libs (-lfson -lcparse):

g++ -std=c++17 main.cpp $(pkg-config --cflags --libs fson) -o app
find_package(PkgConfig REQUIRED)
pkg_check_modules(FSON REQUIRED IMPORTED_TARGET fson)
target_link_libraries(app PkgConfig::FSON)

Embed with add_subdirectory

If you vendor the fson tree inside your own project:

add_subdirectory(third_party/fson)
target_link_libraries(app PRIVATE fson)

In embedded mode fson detects it is not the top-level project (FSON_STANDALONE is OFF): tests and examples default off, the build type is left to your project, the CPack section is skipped, and the docs target is not created — nothing about your build is disturbed. Your project still has to make cparse resolvable (Conan, find_package, or its own add_subdirectory).

Include headers with the fson/ prefix:

#include "fson/Fson.hh"
using namespace fedem::fson;

Binary packages

cpack in the build directory produces component-based packages for 7Z, TGZ, ZIP, DEB and RPM:

cd build
cpack                 # every configured generator
cpack -G DEB          # just one

DEB dependencies come from dpkg-shlibdeps; the RPM requires gcc >= 12.0.

Next