1From 2a0dd2b300242230faa92cf8e26ccd70231bc9ef Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 19 Mar 2022 23:37:58 -0700
4Subject: [PATCH] cmake: Use CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_BINDIR
5
6This ensures the install paths are not hardcoded.
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10Upstream-Status: Pending
11---
12 cmake/CMakeLists.txt       | 4 ++--
13 src/samples/CMakeLists.txt | 4 ++--
14 2 files changed, 4 insertions(+), 4 deletions(-)
15
16diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
17index a9f8908..7eadc60 100644
18--- a/cmake/CMakeLists.txt
19+++ b/cmake/CMakeLists.txt
20@@ -11,7 +11,7 @@ export(EXPORT ${package_name}
21     FILE "${CMAKE_CURRENT_BINARY_DIR}/${package_name}Targets.cmake"
22     NAMESPACE ${package_name}::)
23
24-install(EXPORT ${package_name} DESTINATION lib/cmake/${package_name}
25+install(EXPORT ${package_name} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${package_name}
26     FILE ${package_name}Targets.cmake
27     NAMESPACE ${package_name}::)
28
29@@ -19,4 +19,4 @@ install(FILES
30     "${CMAKE_CURRENT_BINARY_DIR}/${package_name}Config.cmake"
31     FindPahoMqttC.cmake
32     "${CMAKE_CURRENT_BINARY_DIR}/${package_name}ConfigVersion.cmake"
33-    DESTINATION lib/cmake/${package_name})
34+    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${package_name})
35diff --git a/src/samples/CMakeLists.txt b/src/samples/CMakeLists.txt
36index 3ca0a75..c915cd5 100644
37--- a/src/samples/CMakeLists.txt
38+++ b/src/samples/CMakeLists.txt
39@@ -71,7 +71,7 @@ endforeach()
40
41 ## install binaries
42 install(TARGETS ${EXECUTABLES} EXPORT PahoMqttCppSamples
43-  RUNTIME DESTINATION bin
44+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
45 )
46
47 ## Build the SSL/TLS samples, if selected
48@@ -89,7 +89,7 @@ if(PAHO_WITH_SSL)
49   endforeach()
50
51   install(TARGETS ${SSL_EXECUTABLES} EXPORT PahoMqttCppSamples
52-    RUNTIME DESTINATION bin
53+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
54   )
55 endif()
56
57--
582.34.1
59
60