Use variables for installation paths

The installation paths differ for Linux and BSD. Thus use variables for
defining installation paths to avoid duplicating install commands.
This commit is contained in:
Benjamin Drung 2017-05-29 16:45:36 +02:00
parent 97da871e47
commit 28fbaa5d1a

@ -578,26 +578,24 @@ if (BUILD_TESTS)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "DragonFly")
install(TARGETS fastnetmon DESTINATION bin)
install(TARGETS fastnetmon_client DESTINATION bin)
install(FILES fastnetmon.conf DESTINATION etc)
# Install blank files for networks list and whitelist
install(FILES networks_list DESTINATION etc)
install(FILES networks_whitelist DESTINATION etc)
set(CMAKE_INSTALL_BINDIR "bin")
set(CMAKE_INSTALL_SBINDIR "bin")
set(CMAKE_INSTALL_SYSCONFDIR "etc")
else()
# Linux
install(TARGETS fastnetmon DESTINATION /usr/sbin)
install(TARGETS fastnetmon_client DESTINATION /usr/bin)
install(FILES fastnetmon.conf DESTINATION /etc)
# Install blank files for networks list and whitelist
install(FILES networks_list DESTINATION /etc)
install(FILES networks_whitelist DESTINATION /etc)
set(CMAKE_INSTALL_BINDIR "/usr/bin")
set(CMAKE_INSTALL_SBINDIR "/usr/sbin")
set(CMAKE_INSTALL_SYSCONFDIR "/etc")
endif()
install(TARGETS fastnetmon DESTINATION "${CMAKE_INSTALL_SBINDIR}")
install(TARGETS fastnetmon_client DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES fastnetmon.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}")
# Install blank files for networks list and whitelist
install(FILES networks_list DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}")
install(FILES networks_whitelist DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}")
# man pages
install(FILES man/fastnetmon.1 DESTINATION /usr/share/man/man1)
install(FILES man/fastnetmon_client.1 DESTINATION /usr/share/man/man1)