#### Beyond Linux® From Scratch (systemd Edition) - Version r13.0-1167

### Chapter 9. General Libraries

- Prev

  Jansson-2.15.1

- Next

  json-c-0.19

- Up
- Home

# json-3.12.0 (nlohmann-json)

## Introduction to nlohmann-json

The nlohmann-json package provides a header-only in-memory JSON and interface library for C++. The package is simply called “json”, but most refer to it as “nlohmann json” to reduce ambiguity, and is done so here.

### Note

Development versions of BLFS may not build or run some packages properly if LFS or dependencies have been updated since the most recent stable versions of the books.

### Package Information

- Download (HTTP): https://github.com/nlohmann/json/archive/v3.12.0/json-3.12.0.tar.gz

- Download MD5 sum: c2528c3e04faccaaee44f1f8f3d30d99

- Download size: 9.3 MB

- Estimated disk space required: 21 MB (add 477 MB for tests)

- Estimated build time: less than 0.1 SBU (add 5.8 SBU for tests)

### nlohmann-json Dependencies

#### Required

CMake-4.4.2

## Installation of nlohmann-json

Install nlohmann-json by running the following commands:

    mkdir build &&
    cd    build &&

    cmake -D CMAKE_INSTALL_PREFIX=/usr \
          -D CMAKE_BUILD_TYPE=Release  \
          -D JSON_BuildTests=OFF       \
          -G Ninja ..

If you removed the `-D JSON_BuildTests=OFF` parameter, run the test suite by issuing ninja && ninja test. 4 tests are known to fail which fetch contents, but they require that a Git repository for the project is set up.

Now, as the `root` user:

    ninja install

## Command Explanations

`-D JSON_BuildTests=OFF`: This parameter disables building tests, as they can take a while to build. Remove this option if you want to run the test suite.

## Contents

Installed Programs: None
Installed Libraries: None
Installed Directories: /usr/include/nlohmann and /usr/share/cmake/nlohmann_json

- Prev

  Jansson-2.15.1

- Next

  json-c-0.19

- Up
- Home