1From a42d374aa260caec5f683c75d0db322811e51ab9 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 19 Mar 2022 22:40:49 -0700
4Subject: [PATCH] cmake: Use GNUInstallDirs
5
6This helps it make it platform independent, some platforms e.g.
7ppc64/linux use /usr/lib64 for system libraries
8
9Upstream-Status: Submitted [https://github.com/pboettch/json-schema-validator/pull/197]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 CMakeLists.txt | 8 +++++---
13 1 file changed, 5 insertions(+), 3 deletions(-)
14
15diff --git a/CMakeLists.txt b/CMakeLists.txt
16index 9e4587f..3eff234 100644
17--- a/CMakeLists.txt
18+++ b/CMakeLists.txt
19@@ -93,11 +93,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
20     endif()
21 endif()
22
23+include(GNUInstallDirs)
24+
25 if(JSON_VALIDATOR_INSTALL)
26     install(TARGETS nlohmann_json_schema_validator
27             EXPORT ${PROJECT_NAME}Targets
28-            LIBRARY DESTINATION lib
29-            ARCHIVE DESTINATION lib
30+            LIBRARY DESTINATION ${LIBDIR}
31+            ARCHIVE DESTINATION ${LIBDIR}
32             RUNTIME DESTINATION bin)
33
34     install(FILES src/nlohmann/json-schema.hpp
35@@ -129,7 +131,7 @@ endif()
36
37 if(JSON_VALIDATOR_INSTALL)
38     # Set the install path to the cmake config files (Relative, so install works correctly under Hunter as well)
39-    set(INSTALL_CMAKE_DIR "lib/cmake/${PROJECT_NAME}")
40+    set(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
41     set(INSTALL_CMAKEDIR_ROOT share/cmake)
42
43     # Install Targets
44