From 28fbaa5d1a03ebca74da703169bcd39b20da2d4f Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Mon, 29 May 2017 16:45:36 +0200 Subject: [PATCH] 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. --- src/CMakeLists.txt | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f442835..cb8cfe0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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)