check for deb build tools

improved check of rpm
This commit is contained in:
lukas-heiligenbrunner 2019-10-23 21:55:45 +02:00
parent 314795d70d
commit 5012cc517e

View File

@ -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