install files using GNUInstallDirs
This commit is contained in:
+16
-4
@@ -344,11 +344,23 @@ add_custom_target(everything DEPENDS test_suite biboumi)
|
||||
#
|
||||
## Install target
|
||||
#
|
||||
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/biboumi.1 DESTINATION share/man/man1 OPTIONAL COMPONENT documentation)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/biboumi.service DESTINATION lib/systemd/system COMPONENT init)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# From cmake version 4.1 CMAKE_INSTALL_SYSCONFDIR has special behaviour when
|
||||
# CMAKE_INSTALL_PREFIX is /, /usr, or /opt/..., so to not update cmake version
|
||||
# just yet reimplement this here
|
||||
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#special-cases
|
||||
if (CMAKE_INSTALL_SYSCONFDIR STREQUAL "etc" AND (CMAKE_INSTALL_PREFIX STREQUAL "/" OR CMAKE_INSTALL_PREFIX STREQUAL "/usr"))
|
||||
set(CMAKE_INSTALL_SYSCONFDIR "/etc")
|
||||
elseif (CMAKE_INSTALL_SYSCONFDIR STREQUAL "etc" AND (CMAKE_INSTALL_PREFIX MATCHES "^/opt/"))
|
||||
set(CMAKE_INSTALL_SYSCONFDIR "/etc${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
|
||||
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/biboumi.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 OPTIONAL COMPONENT documentation)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/biboumi.service DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/system COMPONENT init)
|
||||
file(GLOB policy_files conf/*policy.txt)
|
||||
install(FILES ${policy_files} DESTINATION etc/biboumi COMPONENT configuration)
|
||||
install(FILES ${policy_files} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/biboumi COMPONENT configuration)
|
||||
|
||||
#
|
||||
## Dist target
|
||||
|
||||
Reference in New Issue
Block a user