From 15c78a27f25d325a6b3f2220c4fd5724048b9517 Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Wed, 15 May 2024 15:31:22 +0200 Subject: [PATCH] [cmake] really use pkg_check_modules results for json-c Although, the `pkg_check_modules` function is used when finding the json-c library, the results are never used. Let's add the `HINTS` params for the `find_path` and `find_library` functions. --- cmake/FindJSONC.cmake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cmake/FindJSONC.cmake b/cmake/FindJSONC.cmake index bb0d19464..464f0359c 100644 --- a/cmake/FindJSONC.cmake +++ b/cmake/FindJSONC.cmake @@ -7,18 +7,21 @@ find_package(PkgConfig) if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_JSON json-c) + pkg_check_modules(PC_JSONC json-c) endif() -find_path(JSONC_INCLUDE_DIR NAMES json-c/json.h json/json.h) -find_library(JSONC_LIBRARY NAMES json-c) +find_path(JSONC_INCLUDE_DIR NAMES json.h + HINTS ${PC_JSONC_INCLUDE_DIRS} + PATH_SUFFIXES json-c) +find_library(JSONC_LIBRARY NAMES json-c + HINTS ${PC_JSONC_LIBRARY_DIRS}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(JSONC DEFAULT_MSG JSONC_LIBRARY JSONC_INCLUDE_DIR) if(JSONC_FOUND) set(JSONC_LIBRARIES ${JSONC_LIBRARY}) - set(JSONC_INCLUDE_DIRS ${JSONC_INCLUDE_DIR}/json-c) + set(JSONC_INCLUDE_DIRS ${JSONC_INCLUDE_DIR}) endif() mark_as_advanced(JSONC_LIBRARY JSONC_INCLUDE_DIR)