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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
From ebe01b5c259fa28b4da24cc1c11ab24a31281b64 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 13 Jul 2020 08:16:59 +0200
Subject: [PATCH] restore GNUInstallDirs
---
CMakeLists.txt | 17 +++++++++--------
lib/CMakeLists.txt | 10 +++++-----
man/CMakeLists.txt | 8 ++++----
3 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8013d2ea..b2f81b1c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,7 @@ include(CheckCSourceRuns)
include(CheckCSourceCompiles)
include(CheckStructHasMember)
include(TestBigEndian)
+include(GNUInstallDirs)
if(ENABLE_COMMONCRYPTO)
check_include_files(CommonCrypto/CommonCrypto.h COMMONCRYPTO_FOUND)
else()
@@ -234,7 +235,7 @@ endif(WIN32)
# rpath handling: use rpath in installed binaries
if(NOT CMAKE_SYSTEM_NAME MATCHES Linux)
- set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
+ set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
@@ -279,9 +280,9 @@ endif()
# pkgconfig file
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix \${prefix})
-set(bindir \${exec_prefix}/bin)
-set(libdir \${exec_prefix}/lib)
-set(includedir \${prefix}/include)
+SET(bindir \${exec_prefix}/${CMAKE_INSTALL_BINDIR})
+SET(libdir \${exec_prefix}/${CMAKE_INSTALL_LIBDIR})
+SET(includedir \${prefix}/${CMAKE_INSTALL_INCLUDEDIR})
if(CMAKE_SYSTEM_NAME MATCHES BSD)
set(PKG_CONFIG_RPATH "-Wl,-R\${libdir}")
endif(CMAKE_SYSTEM_NAME MATCHES BSD)
@@ -295,7 +296,7 @@ foreach(LIB ${LIBS_PRIVATE})
endforeach()
configure_file(libzip.pc.in libzip.pc @ONLY)
if(LIBZIP_DO_INSTALL)
- install(FILES ${PROJECT_BINARY_DIR}/libzip.pc DESTINATION lib/pkgconfig)
+ install(FILES ${PROJECT_BINARY_DIR}/libzip.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
# fixed size integral types
@@ -417,7 +418,7 @@ write_basic_package_version_file("${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-v
COMPATIBILITY AnyNewerVersion)
configure_package_config_file("${PROJECT_NAME}-config.cmake.in" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
- INSTALL_DESTINATION lib/cmake/libzip)
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libzip)
# Add targets to the build-tree export set
export(TARGETS zip
@@ -427,10 +428,10 @@ export(TARGETS zip
if(LIBZIP_DO_INSTALL)
install(FILES ${PROJECT_BINARY_DIR}/zipconf.h DESTINATION include)
install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
- DESTINATION lib/cmake/${PROJECT_NAME}
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
install(EXPORT ${PROJECT_NAME}-targets NAMESPACE libzip:: FILE ${PROJECT_NAME}-targets.cmake
- DESTINATION lib/cmake/${PROJECT_NAME}
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
endif()
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 5a6f1713..082203d0 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -181,11 +181,11 @@ target_include_directories(zip
if(LIBZIP_DO_INSTALL)
install(TARGETS zip
EXPORT ${PROJECT_NAME}-targets
- RUNTIME DESTINATION bin
- ARCHIVE DESTINATION lib
- INCLUDES DESTINATION include
- LIBRARY DESTINATION lib)
- install(FILES zip.h DESTINATION include)
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ install(FILES zip.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
# create zip_err_str.h from zip.h
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index ce714ec4..90d462a5 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -104,10 +104,10 @@ foreach(MAN_PAGE ${MAN_PAGES})
string(REGEX REPLACE "[1-9]$" "${DOCUMENTATION_FORMAT}" SOURCE_FILE ${MAN_PAGE})
if(LIBZIP_DO_INSTALL)
if (DOCUMENTATION_FORMAT MATCHES "html")
- install(FILES ${PROJECT_BINARY_DIR}/man/${MAN_PAGE} DESTINATION share/doc/${PROJECT_NAME} RENAME ${SOURCE_FILE})
+ install(FILES ${PROJECT_BINARY_DIR}/man/${MAN_PAGE} DESTINATION ${CMAKE_INSTALL_DOCDIR}/${PROJECT_NAME} RENAME ${SOURCE_FILE})
else()
string(REGEX REPLACE ".*(.)$" "man\\1" SUBDIR ${MAN_PAGE})
- install(FILES ${PROJECT_BINARY_DIR}/man/${MAN_PAGE} DESTINATION man/${SUBDIR})
+ install(FILES ${PROJECT_BINARY_DIR}/man/${MAN_PAGE} DESTINATION ${CMAKE_INSTALL_MANDIR}/${SUBDIR})
endif()
endif()
# configure_file does not find out about updates to the sources, and it does not provide a target
@@ -147,9 +147,9 @@ foreach(LINKS_LINE ${MANPAGE_LINKS})
set(TARGET ${CMAKE_MATCH_2})
if(LIBZIP_DO_INSTALL)
if (DOCUMENTATION_FORMAT MATCHES "html")
- INSTALL(FILES ${PROJECT_BINARY_DIR}/man/${SOURCE}.3 DESTINATION share/doc/${PROJECT_NAME} RENAME ${TARGET}.html)
+ INSTALL(FILES ${PROJECT_BINARY_DIR}/man/${SOURCE}.3 DESTINATION ${CMAKE_INSTALL_DOCDIR}/${PROJECT_NAME} RENAME ${TARGET}.html)
else()
- INSTALL(FILES ${PROJECT_BINARY_DIR}/man/${SOURCE}.3 DESTINATION man/man3 RENAME ${TARGET}.3)
+ INSTALL(FILES ${PROJECT_BINARY_DIR}/man/${SOURCE}.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 RENAME ${TARGET}.3)
endif()
endif()
endif()
|