From 2a0dd2b300242230faa92cf8e26ccd70231bc9ef Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 19 Mar 2022 23:37:58 -0700
Subject: [PATCH] cmake: Use CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_BINDIR

This ensures the install paths are not hardcoded.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending
---
 cmake/CMakeLists.txt       | 4 ++--
 src/samples/CMakeLists.txt | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -34,7 +34,7 @@ export(EXPORT ${package_name}
 )
 
 install(EXPORT ${package_name}
-  DESTINATION lib/cmake/${package_name}
+  DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${package_name}
   FILE ${package_name}Targets.cmake
   NAMESPACE ${package_name}::
 )
@@ -42,5 +42,5 @@ install(EXPORT ${package_name}
 install(FILES
   "${CMAKE_CURRENT_BINARY_DIR}/${package_name}Config.cmake"
   "${CMAKE_CURRENT_BINARY_DIR}/${package_name}ConfigVersion.cmake"
-  DESTINATION lib/cmake/${package_name}
+  DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${package_name}
 )
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -65,7 +65,7 @@ endforeach()
 
 ## install binaries
 install(TARGETS ${EXECUTABLES} EXPORT PahoMqttCppSamples
-    RUNTIME DESTINATION bin
+    RUNTIME DESTINATION {CMAKE_INSTALL_BINDIR}
 )
 
 ## Build the SSL/TLS samples, if selected
@@ -80,7 +80,7 @@ if(PAHO_WITH_SSL)
     endforeach()
 
     install(TARGETS ${SSL_EXECUTABLES} EXPORT PahoMqttCppSamples
-        RUNTIME DESTINATION bin
+        RUNTIME DESTINATION {CMAKE_INSTALL_BINDIR}
     )
 endif()
 
