Skip to content

Commit c7ebc41

Browse files
Merge pull request #85 from pothosware/use_gnu_install_dirs
use gnu install dirs for cmake install rules
2 parents f0209ab + f7a39bb commit c7ebc41

4 files changed

Lines changed: 12 additions & 13 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ if(NOT CMAKE_BUILD_TYPE)
3535
endif(NOT CMAKE_BUILD_TYPE)
3636
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
3737

38+
# Use standard GNU install paths
39+
include(GNUInstallDirs)
40+
3841
#find soapy sdr with modern cmake support
3942
find_package(SoapySDR "0.8.0" CONFIG)
4043

server/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ if (MSVC)
1515
target_include_directories(SoapySDRServer PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/msvc)
1616
endif ()
1717

18-
install(TARGETS SoapySDRServer DESTINATION bin)
18+
install(TARGETS SoapySDRServer DESTINATION ${CMAKE_INSTALL_BINDIR})
1919

2020
#install man pages for the application executable
21-
install(FILES SoapySDRServer.1 DESTINATION share/man/man1)
21+
install(FILES SoapySDRServer.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
2222

2323
########################################################################
2424
# Thread config support

system/CMakeLists.txt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,7 @@
44
option(ENABLE_SYSTEMD "Install systemd unit" ON)
55
if(ENABLE_SYSTEMD)
66

7-
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
8-
set(SYSTEMD_UNIT_INSTALL_DIR /lib/systemd/system)
9-
else()
10-
#source installs will use the install prefix
11-
set(SYSTEMD_UNIT_INSTALL_DIR lib/systemd/system)
12-
endif()
13-
14-
set(SYSTEMD_UNIT_DIR "${SYSTEMD_UNIT_INSTALL_DIR}" CACHE STRING "Directory to install systemd unit")
7+
set(SYSTEMD_UNIT_DIR "lib/systemd/system" CACHE STRING "Directory to install systemd unit")
158

169
configure_file(
1710
${CMAKE_CURRENT_SOURCE_DIR}/SoapySDRServer.service.in
@@ -20,16 +13,19 @@ if(ENABLE_SYSTEMD)
2013

2114
install(FILES
2215
${CMAKE_CURRENT_BINARY_DIR}/SoapySDRServer.service
23-
DESTINATION ${SYSTEMD_UNIT_DIR})
16+
DESTINATION "${SYSTEMD_UNIT_DIR}")
2417
endif()
2518

2619
########################################################################
2720
# Increase the sysctl network limits
2821
########################################################################
2922
option(ENABLE_SYSCTL "Install kernel tweaks for socket buffer sizes" ON)
3023
if(ENABLE_SYSCTL)
24+
25+
set(SYSCTL_CONFIG_DIR "lib/sysctl.d" CACHE STRING "Directory to install sysctl.d configs")
26+
3127
install(
3228
FILES SoapySDRServer.sysctl
3329
RENAME 10-SoapySDRServer.conf
34-
DESTINATION lib/sysctl.d)
30+
DESTINATION "${SYSCTL_CONFIG_DIR}")
3531
endif()

system/SoapySDRServer.service.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Wants=network-online.target
44
After=network-online.target
55

66
[Service]
7-
ExecStart=@CMAKE_INSTALL_PREFIX@/bin/SoapySDRServer --bind
7+
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/SoapySDRServer --bind
88
KillMode=process
99
Restart=on-failure
1010
LimitRTPRIO=99

0 commit comments

Comments
 (0)