Use GNUInstallDirs macros master
authorJuan Orti Alcaine <jorti@pm.me>
Wed, 5 Feb 2025 09:29:40 +0000 (10:29 +0100)
committerdedeckeh <dedeckeh@gmail.com>
Thu, 6 Feb 2025 20:38:52 +0000 (21:38 +0100)
Instead of installing to a hardcoded path, use the macros from GNUInstallDirs.
This allows proper override of the directories at build time.

This was discovered because the package failed to build in Fedora with the
bin-sbin merge change:

https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin
https://bugzilla.redhat.com/show_bug.cgi?id=2340955

Signed-off-by: Juan Orti Alcaine <jorti@pm.me>
CMakeLists.txt

index 94f279cc589caf1acbc96285fcc5ace4adb7730d..3387fd0a933818dd26d1cd5d81024ec488bd1c4f 100644 (file)
@@ -38,7 +38,8 @@ add_executable(odhcp6c ${SOURCES})
 target_link_libraries(odhcp6c ${LIBRARIES})
 
 # Installation
-install(TARGETS odhcp6c DESTINATION sbin/)
+include(GNUInstallDirs)
+install(TARGETS odhcp6c DESTINATION "${CMAKE_INSTALL_SBINDIR}")
 
 # Packaging information
 set(CPACK_PACKAGE_VERSION "1")