summaryrefslogtreecommitdiff
path: root/cmake/Findnlohmann_json.cmake
blob: 4be1475e73e974b2be1bd6765d5bc0b2b8cf64de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
set(NLOHMANN_JSON_LIBRARY_NAME nlohmann_json)

find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
    pkg_check_modules(PC_NLOHMANN_JSON QUIET ${NLOHMANN_JSON_LIBRARY_NAME})
    set(NLOHMANN_JSON_DEFINITIONS ${PC_NLOHMANN_JSON_CFLAGS_OTHER})
endif()

set(NLOHMANN_JSON_INCLUDE_HINTS ${PC_NLOHMANN_JSON_INCLUDEDIR}  ${PC_NLOHMANN_JSON_INCLUDE_DIRS})

set(NLOHMANN_JSON_ROOT_DIR "$ENV{NLOHMANN_JSON_ROOT_DIR}")

find_path(NLOHMANN_JSON_INCLUDE_DIR
          NAMES nlohmann/json.hpp
          PATHS $ENV{PROGRAMFILES}/include/
                ${NLOHMANN_JSON_ROOT_DIR}/
                ${NLOHMANN_JSON_ROOT_DIR}/include/
          HINTS ${NLOHMANN_JSON_INCLUDE_HINTS})

set(NLOHMANN_JSON_INCLUDE_DIRS ${NLOHMANN_JSON_INCLUDE_DIR})
set(NLOHMANN_JSON_LIBRARIES    "")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(nlohmann_json
                                  REQUIRED_VARS
                                    NLOHMANN_JSON_INCLUDE_DIR
                                  VERSION_VAR NLOHMANN_JSON_VERSION)