[meta-oe,07/17] json-schema-validator: Use GNUInstallDirs in cmake

Message ID 20220320080815.825928-7-raj.khem@gmail.com
State New
Headers show
Series [meta-oe,01/17] librdkafka: Use CMAKE_INSTALL_LIBDIR | expand

Commit Message

Khem Raj March 20, 2022, 8:08 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0001-cmake-Use-GNUInstallDirs.patch       | 46 +++++++++++++++++++
 .../json-schema-validator_2.1.0.bb            |  4 +-
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0001-cmake-Use-GNUInstallDirs.patch

Patch

diff --git a/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0001-cmake-Use-GNUInstallDirs.patch b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0001-cmake-Use-GNUInstallDirs.patch
new file mode 100644
index 0000000000..4b1184a394
--- /dev/null
+++ b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0001-cmake-Use-GNUInstallDirs.patch
@@ -0,0 +1,46 @@ 
+From e0b1ad02c678513412aba95a1b2fb4005c3c0452 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 19 Mar 2022 22:40:49 -0700
+Subject: [PATCH] cmake: Use GNUInstallDirs
+
+This helps it make it platform independent, some platforms e.g.
+ppc64/linux use /usr/lib64 for system libraries
+
+Upstream-Status: Submitted [https://github.com/pboettch/json-schema-validator/pull/197]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ CMakeLists.txt | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c4cc218..594dc5f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -122,11 +122,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+     endif()
+ endif()
+ 
++include(GNUInstallDirs)
++
+ if(JSON_VALIDATOR_INSTALL)
+     install(TARGETS nlohmann_json_schema_validator
+             EXPORT ${PROJECT_NAME}Targets
+-            LIBRARY DESTINATION lib
+-            ARCHIVE DESTINATION lib
++            LIBRARY DESTINATION ${LIBDIR}
++            ARCHIVE DESTINATION ${LIBDIR}
+             RUNTIME DESTINATION bin)
+ 
+     install(FILES src/nlohmann/json-schema.hpp
+@@ -155,7 +157,7 @@ if(JSON_VALIDATOR_INSTALL)
+     # Set Up the Project Targets and Config Files for CMake
+ 
+     # Set the install path to the cmake config files
+-    set(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_PREFIX}/lib/cmake/${PROJECT_NAME})
++    set(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
+ 
+     # Create the ConfigVersion file
+     include(CMakePackageConfigHelpers) # write_basic_package_version_file
+-- 
+2.35.1
+
diff --git a/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator_2.1.0.bb b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator_2.1.0.bb
index 4a8de5f3b0..00d26d7b34 100644
--- a/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator_2.1.0.bb
+++ b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator_2.1.0.bb
@@ -2,7 +2,9 @@  SUMMARY = "JSON schema validator for JSON for Modern C++"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=c441d022da1b1663c70181a32225d006"
 
-SRC_URI = "git://github.com/pboettch/json-schema-validator;branch=master;protocol=https"
+SRC_URI = "git://github.com/pboettch/json-schema-validator;branch=master;protocol=https \
+           file://0001-cmake-Use-GNUInstallDirs.patch \
+          "
 SRCREV = "27fc1d094503623dfe39365ba82581507524545c"
 
 S = "${WORKDIR}/git"