summaryrefslogtreecommitdiff
blob: 66b8f91183f04e5f10d8bec0df16a17d08211366 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From f89f1341cf59f7098af985ecd683d5e0407d2dc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sun, 20 Dec 2020 10:52:34 +0100
Subject: [PATCH] cmake: Use GNUInstallDirs for configurable install
 directories

Use the standard GNUInstallDirs CMake module to provide configurable
install directories rather than hardcoding 'bin', 'lib', etc.  Most
importantly, this fixes install on modern amd64 systems that use 'lib64'
rather than 'lib'.
---
 CMakeLists.txt | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd8d336..2b09191 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 2.8.12)
 set(LIBRARY_NAME storm)
 
 include(CMakeDependentOption)
+include(GNUInstallDirs)
 
 option(BUILD_SHARED_LIBS "Compile shared libraries" OFF)
 option(STORM_SKIP_INSTALL "Skip installing files" OFF)
@@ -331,12 +332,12 @@ endif()
 
 if (NOT STORM_SKIP_INSTALL)
     install(TARGETS ${LIBRARY_NAME} 
-	    RUNTIME DESTINATION bin 
-	    LIBRARY DESTINATION lib 
-	    ARCHIVE DESTINATION lib 
+	    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+	    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+	    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
 	    FRAMEWORK DESTINATION /Library/Frameworks
-	    PUBLIC_HEADER DESTINATION include
-	    INCLUDES DESTINATION include)
+	    PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+	    INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
 
         #CPack configurtion
         SET(CPACK_GENERATOR "DEB" "RPM")
@@ -369,6 +370,6 @@ endif()
 if(STORM_BUILD_TESTS)
     add_executable(StormLib_test ${TEST_SRC_FILES})
     target_link_libraries(StormLib_test ${LIBRARY_NAME})
-    install(TARGETS StormLib_test RUNTIME DESTINATION bin)
+    install(TARGETS StormLib_test RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
 
-- 
2.29.2