DynuIPRefresher/CMakeLists.txt

91 lines
3.1 KiB
CMake
Raw Normal View History

2019-10-23 20:05:10 +00:00
cmake_minimum_required(VERSION 3.13)
project(iprefresher VERSION 1.2.0 DESCRIPTION "Dynu ip refresher")
2019-05-01 09:14:52 +00:00
set(CMAKE_CXX_STANDARD 17)
2019-05-01 09:14:52 +00:00
set(CMAKE_BUILD_TYPE Release) # manually set build type (Release / Debug)
set(libmethod STATIC) #SHARED / STATIC
2019-08-01 20:31:58 +00:00
2019-05-01 09:14:52 +00:00
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIR} inc)
2019-05-01 09:14:52 +00:00
add_library(api ${libmethod}
src/api/API.cpp
src/api/TelegramAPI.cpp
src/api/DynuAPI.cpp
src/api/IPAPI.cpp
)
add_library(logger ${libmethod}
src/Logger.cpp
)
set(SOURCE
src/main.cpp
src/IPRefresher.cpp inc/IPRefresher.h)
2019-05-05 13:38:48 +00:00
add_executable(iprefresher ${SOURCE})
# LINK generated LIBS #
target_link_libraries(iprefresher api logger ${CURL_LIBRARIES})
2019-05-01 09:14:52 +00:00
# INSTALL to SYSTEM #
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)
message(STATUS ${DEB_EXECUTABLE})
SET(CPACK_GENERATOR "TGZ;TBZ2")
#check if rpm build is possible
if (NOT ${RPMBUILD_EXECUTABLE} STREQUAL "RPMBUILD_EXECUTABLE-NOTFOUND")
message(STATUS "found rpm build executeable --> able to build rpm")
set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
2019-10-23 20:05:10 +00:00
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/lib/systemd/system" "/usr/lib/systemd") # --> needed to not override existing folders
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")
SET(CPACK_SOURCE_GENERATOR "TGZ;TBZ2")
SET(CPACK_PACKAGE_DESCRIPTION "IPrefresher to refresh Dynu ip address and notify user via Telegram")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "IPrefresher to refresh Dynu ip address and notify user via Telegram")
SET(CPACK_PACKAGE_VENDOR "Lukas Heilgienbrunner")
2019-10-23 07:32:33 +00:00
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "2")
SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")
SET(CPACK_PACKAGE_CONTACT "Lukas Heiligenbrunner <ultimategameingcookie@gmail.com>")
SET(CPACK_PACKAGE_SECTION "games")
INCLUDE(CPack)
ENDIF (UNIX)
2019-10-23 20:05:10 +00:00
#todo all
add_custom_target(build-linux-packages ALL
"${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target package
DEPENDS ${PROJECT_NAME}
COMMENT "Installing ${PROJECT_NAME}")