restore GNUInstallDirs
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8013d2e..b2f81b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,7 @@
include(CheckCSourceCompiles)
include(CheckStructHasMember)
include(TestBigEndian)
+include(GNUInstallDirs)
if(ENABLE_COMMONCRYPTO)
check_include_files(CommonCrypto/CommonCrypto.h COMMONCRYPTO_FOUND)
else()
@@ -234,7 +235,7 @@
# 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 @@
# 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 @@
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 @@
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 @@
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 5a6f171..082203d 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -181,11 +181,11 @@
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 ce714ec..90d462a 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -104,10 +104,10 @@
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 @@
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()