update: rename filedir to work with new version of leaf
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
find_path(JsonCpp_INCLUDE_DIR "json/json.h"
|
||||
PATH_SUFFIXES "jsoncpp"
|
||||
DOC "jsoncpp include directory")
|
||||
mark_as_advanced(JsonCpp_INCLUDE_DIR)
|
||||
|
||||
find_library(JsonCpp_LIBRARY
|
||||
NAMES jsoncpp
|
||||
DOC "jsoncpp library")
|
||||
mark_as_advanced(JsonCpp_LIBRARY)
|
||||
|
||||
if (JsonCpp_INCLUDE_DIR AND EXISTS "${JsonCpp_INCLUDE_DIR}/json/version.h")
|
||||
file(STRINGS "${JsonCpp_INCLUDE_DIR}/json/version.h" _JsonCpp_version_lines
|
||||
REGEX "JSONCPP_VERSION_[A-Z]+")
|
||||
string(REGEX REPLACE ".*# *define +JSONCPP_VERSION_MAJOR +([0-9]+).*" "\\1" _JsonCpp_version_major "${_JsonCpp_version_lines}")
|
||||
string(REGEX REPLACE ".*# *define +JSONCPP_VERSION_MINOR +([0-9]+).*" "\\1" _JsonCpp_version_minor "${_JsonCpp_version_lines}")
|
||||
string(REGEX REPLACE ".*# *define +JSONCPP_VERSION_PATCH +([0-9]+).*" "\\1" _JsonCpp_version_patch "${_JsonCpp_version_lines}")
|
||||
set(JsonCpp_VERSION "${_JsonCpp_version_major}.${_JsonCpp_version_minor}.${_JsonCpp_version_patch}")
|
||||
unset(_JsonCpp_version_major)
|
||||
unset(_JsonCpp_version_minor)
|
||||
unset(_JsonCpp_version_patch)
|
||||
unset(_JsonCpp_version_lines)
|
||||
endif ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(JsonCpp
|
||||
REQUIRED_VARS JsonCpp_LIBRARY JsonCpp_INCLUDE_DIR
|
||||
VERSION_VAR JsonCpp_VERSION)
|
||||
|
||||
if (JsonCpp_FOUND)
|
||||
set(JsonCpp_INCLUDE_DIRS "${JsonCpp_INCLUDE_DIR}")
|
||||
set(JsonCpp_LIBRARIES "${JsonCpp_LIBRARY}")
|
||||
|
||||
if (NOT TARGET JsonCpp::JsonCpp)
|
||||
add_library(JsonCpp::JsonCpp SHARED IMPORTED)
|
||||
set_target_properties(JsonCpp::JsonCpp PROPERTIES
|
||||
IMPORTED_LOCATION "${JsonCpp_LIBRARY}"
|
||||
IMPORTED_IMPLIB "${JsonCpp_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${JsonCpp_INCLUDE_DIR}")
|
||||
endif ()
|
||||
endif ()
|
||||
@@ -0,0 +1,44 @@
|
||||
From 2fe6cac5797bead74c473c795fdc5f9d50703894 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Zander <negril.nx+gentoo@gmail.com>
|
||||
Date: Thu, 6 Mar 2025 13:19:01 +0100
|
||||
Subject: [PATCH] fix JsonCPP name
|
||||
|
||||
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
|
||||
|
||||
diff --git a/cmake/conformance.cmake b/cmake/conformance.cmake
|
||||
index 7377841..dba05aa 100644
|
||||
--- a/cmake/conformance.cmake
|
||||
+++ b/cmake/conformance.cmake
|
||||
@@ -1,9 +1,9 @@
|
||||
# Don't run jsoncpp tests.
|
||||
set(JSONCPP_WITH_TESTS OFF)
|
||||
|
||||
-if (NOT TARGET jsoncpp_lib)
|
||||
+if (NOT TARGET JsonCpp::JsonCpp)
|
||||
if (NOT protobuf_FORCE_FETCH_DEPENDENCIES)
|
||||
- find_package(jsoncpp)
|
||||
+ find_package(JsonCpp)
|
||||
endif()
|
||||
|
||||
# Fallback to fetching Googletest from github if it's not found locally.
|
||||
@@ -21,7 +21,7 @@ if (NOT TARGET jsoncpp_lib)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
-if (NOT TARGET jsoncpp_lib)
|
||||
+if (NOT TARGET JsonCpp::JsonCpp)
|
||||
message(FATAL_ERROR
|
||||
"Cannot find jsoncpp dependency that's needed to build conformance tests.\n"
|
||||
"If instead you want to skip these tests, run cmake with:\n"
|
||||
@@ -151,7 +151,7 @@ add_test(NAME conformance_cpp_test
|
||||
set(JSONCPP_WITH_TESTS OFF CACHE BOOL "Disable tests")
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
- target_link_libraries(conformance_test_runner jsoncpp_lib)
|
||||
+ target_link_libraries(conformance_test_runner JsonCpp::JsonCpp)
|
||||
else()
|
||||
target_link_libraries(conformance_test_runner jsoncpp_static)
|
||||
endif()
|
||||
--
|
||||
2.48.1
|
||||
|
||||
Reference in New Issue
Block a user