diff --git a/CMake/FindYAMLCpp.cmake b/CMake/FindYAMLCpp.cmake new file mode 100644 index 0000000000000000000000000000000000000000..a3e0589299fad70365b0ee11dfddb10ca3ad9dcf --- /dev/null +++ b/CMake/FindYAMLCpp.cmake @@ -0,0 +1,109 @@ +## +# Copyright 2018-2020, Barcelona Supercomputing Center (BSC), Spain +# Copyright 2015-2020, Johannes Gutenberg Universitaet Mainz, Germany +# +# This software was partially supported by the +# EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu). +# +# This software was partially supported by the +# ADA-FS project under the SPPEXA project funded by the DFG. +# +# SPDX-License-Identifier: MIT +## + +#[=======================================================================[.rst: +FindYAMLCpp +--------- + +Find yaml-cpp include dirs and libraries. + +Use this module by invoking find_package with the form:: + + find_package(YAMLCpp + [version] [EXACT] # Minimum or EXACT version e.g. 0.6.2 + [REQUIRED] # Fail with error if yaml-cpp is not found + ) + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module provides the following imported targets, if found: + +``YAMLCpp::YAMLCpp`` + The YAMLCpp library + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``YAMLCpp_FOUND`` + True if the system has the YAMLCpp library. +``YAMLCpp_VERSION`` + The version of the YAMLCpp library which was found. +``YAMLCpp_INCLUDE_DIRS`` + Include directories needed to use YAMLCpp. +``YAMLCpp_LIBRARIES`` + Libraries needed to link to YAMLCpp. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``YAMLCpp_INCLUDE_DIR`` + The directory containing ``yaml.h``. +``YAMLCpp_LIBRARY`` + The path to the YAMLCpp library. + +#]=======================================================================] + +# yaml-cpp already provides a config file, but sadly it doesn't define +# a target with the appropriate properties. Fortunately, it also provides a +# pkg-config .pc file that we can use to fetch the required library properties +# and wrap them neatly into the 'YAMLCpp' target we provide +find_package(PkgConfig) +pkg_check_modules(PC_YAMLCpp QUIET yaml-cpp) + +find_path(YAMLCpp_INCLUDE_DIR + NAMES yaml-cpp/yaml.h + PATHS ${PC_YAMLCpp_INCLUDE_DIRS} + PATH_SUFFIXES YAMLCpp +) + +find_library(YAMLCpp_LIBRARY + NAMES yaml-cpp + PATHS ${PC_YAMLCpp_LIBRARY_DIRS} +) + +mark_as_advanced( + YAMLCpp_INCLUDE_DIR + YAMLCpp_LIBRARY +) + +set(YAMLCpp_VERSION ${PC_YAMLCpp_VERSION}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(YAMLCpp + FOUND_VAR YAMLCpp_FOUND + REQUIRED_VARS + YAMLCpp_LIBRARY + YAMLCpp_INCLUDE_DIR + VERSION_VAR YAMLCpp_VERSION +) + +if(YAMLCpp_FOUND) + set(YAMLCpp_LIBRARIES ${YAMLCpp_LIBRARY}) + set(YAMLCpp_INCLUDE_DIRS ${YAMLCpp_INCLUDE_DIR}) + set(YAMLCpp_DEFINITIONS ${PC_YAMLCpp_CFLAGS_OTHER}) +endif() + +if(YAMLCpp_FOUND AND NOT TARGET YAMLCpp::YAMLCpp) + add_library(YAMLCpp::YAMLCpp UNKNOWN IMPORTED) + set_target_properties(YAMLCpp::YAMLCpp PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${YAMLCpp_LIBRARY}" + INTERFACE_COMPILE_DEFINITIONS "${PC_YAMLCpp_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${YAMLCpp_INCLUDE_DIR}" +) +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f3a2a1904891c7b0db0b2cf55fb67151822efa9..7a30a9dae58964fc78c0194ffb6911213c8affc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,9 @@ find_package(Threads REQUIRED) find_package(Date REQUIRED) +# yaml-cpp is required for reading configuration files +find_package(YAMLCpp 0.6.2 REQUIRED) + option(CREATE_CHECK_PARENTS "Check parent directory existance before creating child node" ON) message(STATUS "[gekkofs] Create checks parents: ${CREATE_CHECK_PARENTS}") diff --git a/README.md b/README.md index 96c439c45fa6cf63e504ccef52955ef2701d2663..9c66d29c04597433e702ec6cd1b8de74f967fc34 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ to I/O, which reduces interferences and improves performance. - lz4: `sudo apt-get install liblz4-dev` - uuid: `sudo apt-get install uuid-dev` - capstone: `sudo apt-get install libcapstone-dev` +- yaml-cpp: `sudo apt-get install libyaml-dev` ### CentOS/Red Hat - Dependencies @@ -40,6 +41,7 @@ to I/O, which reduces interferences and improves performance. - lz4: `sudo yum install lz4 lz4-devel` - uuid: `sudo yum install libuuid-devel` - capstone: `sudo yum install capstone capstone-devel` +- yaml-cpp: `sudo yum install yaml-cpp-devel` # Usage