Newer
Older
Import / applications / MakePDF / 3rdParty / libharu / pr-patches / 0001-Use-CMAKE_INSTALL_LIBDIR-instead-of-hardcode.patch
From efab90115cdd5cc7c5d12c54144449d917bd2642 Mon Sep 17 00:00:00 2001
From: Maxim Ivanov <ulidtko@gmail.com>
Date: Tue, 24 May 2016 16:59:45 +0300
Subject: [PATCH] Use CMAKE_INSTALL_LIBDIR instead of hardcode

When packaging an RPM for x86_64, it's uncomforting to find the `libhpdf.so` under $prefix/usr/lib instead of $prefix/usr/lib64 after `make install`, despite setting `CMAKE_INSTALL_LIBDIR` to `lib64`.

The `CMAKE_INSTALL_LIBDIR` variable is even printed out as a *location variable which can be set by the user*. So - use it here!

It'd be nice to also provide a default value for `CMAKE_INSTALL_LIBDIR`, for the case when user doesn't set it explicitly.
It'd be nice to also handle `CMAKE_INSTALL_INCLUDEDIR` and `CMAKE_INSTALL_BINDIR` in the same fashion.
I leave this out for now, since it doesn't matter for my use-case (the specfile always sets `CMAKE_INSTALL_*DIR` anyway).

The unrelevant `<foo> DESTINATION` flags are removed, too, in this patch.
---
 src/CMakeLists.txt | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9d2a604..f5d194e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -75,9 +75,7 @@ if(LIBHPDF_STATIC)
   target_link_libraries(${LIBHPDF_NAME_STATIC} ${ADDITIONAL_LIBRARIES})
   install(
     TARGETS ${LIBHPDF_NAME_STATIC}
-    ARCHIVE DESTINATION lib
-    LIBRARY DESTINATION lib
-    RUNTIME DESTINATION bin
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
   )
   if(WIN32 AND NOT CYGWIN)
 		foreach(addlib ${ADDITIONAL_LIBRARIES})
@@ -93,8 +91,6 @@ if(LIBHPDF_SHARED)
   endif(WIN32 AND NOT CYGWIN)
   install(
     TARGETS ${LIBHPDF_NAME}
-    ARCHIVE DESTINATION lib
-    LIBRARY DESTINATION lib
-    RUNTIME DESTINATION bin
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
   )
 endif(LIBHPDF_SHARED)
-- 
2.21.1 (Apple Git-122.3)