Skip to content

Commit b9e0d77

Browse files
flichtenhelddsommers
authored andcommitted
vcpkg-ports: add patch for jsoncpp
See open-source-parsers/jsoncpp#1356 Signed-off-by: Frank Lichtenheld <[email protected]>
1 parent 2996dfb commit b9e0d77

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
From 05b0128123e9c1e81522864ba5321ebc62e4c9b8 Mon Sep 17 00:00:00 2001
2+
From: Frank Lichtenheld <[email protected]>
3+
Date: Wed, 17 Nov 2021 17:13:29 +0100
4+
Subject: [PATCH] cmake: protect JsonCpp::JsonCpp against multiple includes
5+
6+
Similar to what we have in jsoncpp-targets.cmake
7+
8+
Signed-off-by: Frank Lichtenheld <[email protected]>
9+
---
10+
jsoncpp-namespaced-targets.cmake | 6 +++++-
11+
1 file changed, 5 insertions(+), 1 deletion(-)
12+
13+
diff --git a/jsoncpp-namespaced-targets.cmake b/jsoncpp-namespaced-targets.cmake
14+
index ac1504e..5339403 100644
15+
--- a/jsoncpp-namespaced-targets.cmake
16+
+++ b/jsoncpp-namespaced-targets.cmake
17+
@@ -1,7 +1,11 @@
18+
+if (TARGET JsonCpp::JsonCpp)
19+
+ return()
20+
+endif()
21+
+
22+
if (TARGET jsoncpp_static)
23+
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
24+
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_static")
25+
elseif (TARGET jsoncpp_lib)
26+
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
27+
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_lib")
28+
-endif ()
29+
\ No newline at end of file
30+
+endif ()
31+
--
32+
2.30.2
33+

Diff for: deps/vcpkg-ports/jsoncpp/portfile.cmake

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
vcpkg_from_github(
2+
OUT_SOURCE_PATH SOURCE_PATH
3+
REPO open-source-parsers/jsoncpp
4+
REF 1.9.5
5+
SHA512 1d06e044759b1e1a4cc4960189dd7e001a0a4389d7239a6d59295af995a553518e4e0337b4b4b817e70da5d9731a4c98655af90791b6287870b5ff8d73ad8873
6+
HEAD_REF master
7+
PATCHES
8+
"0001-cmake-protect-JsonCpp-JsonCpp-against-multiple-inclu.patch"
9+
)
10+
11+
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" JSONCPP_STATIC)
12+
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT)
13+
14+
vcpkg_cmake_configure(
15+
SOURCE_PATH "${SOURCE_PATH}"
16+
OPTIONS
17+
-DJSONCPP_WITH_CMAKE_PACKAGE=ON
18+
-DBUILD_STATIC_LIBS=${JSONCPP_STATIC}
19+
-DJSONCPP_STATIC_WINDOWS_RUNTIME=${STATIC_CRT}
20+
-DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF
21+
-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF
22+
-DJSONCPP_WITH_TESTS=OFF
23+
-DJSONCPP_WITH_EXAMPLE=OFF
24+
)
25+
26+
vcpkg_cmake_install()
27+
28+
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/jsoncpp)
29+
30+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
31+
32+
vcpkg_copy_pdbs()
33+
34+
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

Diff for: deps/vcpkg-ports/jsoncpp/vcpkg.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "jsoncpp",
3+
"version": "1.9.5",
4+
"port-version": 42,
5+
"description": "jsoncpp is an implementation of a JSON reader and writer in C++. JSON (JavaScript Object Notation) is a lightweight data-interchange format that it is easy to parse and redeable for human.",
6+
"homepage": "https://github.com/open-source-parsers/jsoncpp",
7+
"dependencies": [
8+
{
9+
"name": "vcpkg-cmake",
10+
"host": true
11+
},
12+
{
13+
"name": "vcpkg-cmake-config",
14+
"host": true
15+
}
16+
]
17+
}

0 commit comments

Comments
 (0)