A Header-only library that makes it easy to use Linux utility commands.
Supported lsblk command versions: 2.29.2 or later (Test on 2.29.2 and 2.33.1)
#include <util_linux/lsblk.hpp>
nlohmann::json result = util_linux::lsblk();
std::cout << result.dump(4) << std::endl;
util_linux::lsblk("/dev/sda");
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
# create project
project(MyProject)
# add executable
add_executable(tests tests.cpp)
# add dependencies
include(cmake/CPM.cmake)
CPMAddPackage("gh:ntoskrnl7/util-linux-cpp@0.1.2")
# link dependencies
target_link_libraries(tests util-linux)
cd tests
mkdir build && cd build
cmake ..
cmake --build .
./unittest