From 5012cc517ed130fc4f1ce01378110e8ee3e24e02 Mon Sep 17 00:00:00 2001 From: lukas-heiligenbrunner Date: Wed, 23 Oct 2019 21:55:45 +0200 Subject: [PATCH] check for deb build tools improved check of rpm --- CMakeLists.txt | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3f398f..9eaf4ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,29 +29,40 @@ set(SOURCE src/main.cpp src/IPRefresher.cpp inc/IPRefresher.h) -add_executable(iprefresher ${SOURCE}) +add_executable(iprefresher ${SOURCE}) # LINK generated LIBS # -target_link_libraries(iprefresher api logger ${CURL_LIBRARIES} ) +target_link_libraries(iprefresher api logger ${CURL_LIBRARIES}) # INSTALL to SYSTEM # -install (TARGETS iprefresher DESTINATION bin) +install(TARGETS iprefresher DESTINATION bin) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/iprefresher.service DESTINATION lib/systemd/system) SET(CPACK_DEB_COMPONENT_INSTALL 1) IF (UNIX) FIND_PROGRAM(RPMBUILD_EXECUTABLE rpmbuild) + FIND_PROGRAM(DEB_EXECUTABLE dpkg) - SET(CPACK_GENERATOR "TGZ;TBZ2;DEB") + message(STATUS ${DEB_EXECUTABLE}) + + SET(CPACK_GENERATOR "TGZ;TBZ2") #check if rpm build is possible - if(NOT ${RPMBUILD_EXECUTABLE} STREQUAL "") + if (NOT ${RPMBUILD_EXECUTABLE} STREQUAL "RPMBUILD_EXECUTABLE-NOTFOUND") message(STATUS "found rpm build executeable --> able to build rpm") set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM") - endif(NOT ${RPMBUILD_EXECUTABLE} STREQUAL "") - + else (NOT ${RPMBUILD_EXECUTABLE} STREQUAL "RPMBUILD_EXECUTABLE-NOTFOUND") + message(STATUS "not found rpm build tools --> not building rpm") + endif (NOT ${RPMBUILD_EXECUTABLE} STREQUAL "RPMBUILD_EXECUTABLE-NOTFOUND") + #check if deb build is possible + if (NOT ${DEB_EXECUTABLE} STREQUAL "DEB_EXECUTABLE-NOTFOUND") + message(STATUS "found deb build tools --> able to build deb") + set(CPACK_GENERATOR "${CPACK_GENERATOR};DEB") + else (NOT ${DEB_EXECUTABLE} STREQUAL "DEB_EXECUTABLE-NOTFOUND") + message(STATUS "not found deb build tools --> not building deb") + endif (NOT ${DEB_EXECUTABLE} STREQUAL "DEB_EXECUTABLE-NOTFOUND") SET(CPACK_CMAKE_GENERATOR "Unix Makefiles") @@ -71,9 +82,6 @@ IF (UNIX) INCLUDE(CPack) - - - ENDIF (UNIX) add_custom_target(build-linux-packages