lots cmake improvements

correct non root packaging
This commit is contained in:
lukas 2020-04-29 18:33:30 +02:00
parent 54a0ea9f98
commit 5499fadac8
3 changed files with 17 additions and 13 deletions

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SerialMonitorSettings" BaudRate="9600" LineEndingsIndex="0" ShowStatusWidget="false" />
</project>

View File

@ -94,14 +94,16 @@ add_executable(iprefresher ${SOURCE})
target_link_libraries(iprefresher api logger ${CURL_LIBRARIES}) target_link_libraries(iprefresher api logger ${CURL_LIBRARIES})
# INSTALL to SYSTEM # # INSTALL to SYSTEM #
install(TARGETS iprefresher DESTINATION bin) set(CMAKE_INSTALL_PREFIX "/")
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/iprefresher.service DESTINATION /lib/systemd/system) install(TARGETS iprefresher DESTINATION usr/local/bin)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/iprefresher.service DESTINATION lib/systemd/system)
IF (UNIX) IF (UNIX)
message(STATUS "config of Package build") message(STATUS "config of Package build")
SET(CPACK_DEB_COMPONENT_INSTALL 1) SET(CPACK_DEB_COMPONENT_INSTALL 1)
SET(CPACK_OUTPUT_FILE_PREFIX packages) SET(CPACK_OUTPUT_FILE_PREFIX packages)
set(CPACK_PACKAGING_INSTALL_PREFIX "/") # no prefix for package structure
FIND_PROGRAM(RPMBUILD_EXECUTABLE rpmbuild) FIND_PROGRAM(RPMBUILD_EXECUTABLE rpmbuild)
FIND_PROGRAM(DEB_EXECUTABLE dpkg) FIND_PROGRAM(DEB_EXECUTABLE dpkg)
@ -112,7 +114,7 @@ IF (UNIX)
if (NOT ${RPMBUILD_EXECUTABLE} STREQUAL "RPMBUILD_EXECUTABLE-NOTFOUND") if (NOT ${RPMBUILD_EXECUTABLE} STREQUAL "RPMBUILD_EXECUTABLE-NOTFOUND")
message(STATUS "found rpm build executeable --> able to build rpm") message(STATUS "found rpm build executeable --> able to build rpm")
set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM") set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/lib/systemd/system" "/lib/systemd" "/lib") # --> needed to not override existing folders set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/lib/systemd/system" "/lib/systemd" "/lib" "/usr/local/bin" "/usr/local") # --> needed to not override existing folders
else (NOT ${RPMBUILD_EXECUTABLE} STREQUAL "RPMBUILD_EXECUTABLE-NOTFOUND") else (NOT ${RPMBUILD_EXECUTABLE} STREQUAL "RPMBUILD_EXECUTABLE-NOTFOUND")
message(STATUS "not found rpm build tools --> not building rpm") message(STATUS "not found rpm build tools --> not building rpm")
endif (NOT ${RPMBUILD_EXECUTABLE} STREQUAL "RPMBUILD_EXECUTABLE-NOTFOUND") endif (NOT ${RPMBUILD_EXECUTABLE} STREQUAL "RPMBUILD_EXECUTABLE-NOTFOUND")
@ -132,12 +134,9 @@ IF (UNIX)
SET(CPACK_PACKAGE_DESCRIPTION "IPrefresher to refresh Dynu ip address and notify user via Telegram") 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_DESCRIPTION_SUMMARY "IPrefresher to refresh Dynu ip address and notify user via Telegram")
SET(CPACK_PACKAGE_VENDOR "Lukas Heilgienbrunner") SET(CPACK_PACKAGE_VENDOR "Lukas Heilgienbrunner")
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "2")
set(CPACK_PACKAGE_VERSION_PATCH "1")
SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}") SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}")
SET(CPACK_PACKAGE_CONTACT "Lukas Heiligenbrunner <ultimategameingcookie@gmail.com>") SET(CPACK_PACKAGE_CONTACT "Lukas Heiligenbrunner <lukas.heiligenbrunner@gmail.com>")
SET(CPACK_PACKAGE_SECTION "games") SET(CPACK_PACKAGE_SECTION "games")
set(CPACK_PACKAGE_DEPENDS "libcurl (>= 7.0.0-1)") set(CPACK_PACKAGE_DEPENDS "libcurl (>= 7.0.0-1)")
@ -170,7 +169,6 @@ if (BUILD_DOC)
COMMENT "Generating API documentation with Doxygen" COMMENT "Generating API documentation with Doxygen"
VERBATIM) VERBATIM)
message(STATUS "Successfully configured doxygen") message(STATUS "Successfully configured doxygen")
else (DOXYGEN_FOUND) else (DOXYGEN_FOUND)
message(STATUS "Doxygen need to be installed to generate the doxygen documentation") message(STATUS "Doxygen need to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND) endif (DOXYGEN_FOUND)

View File

@ -5,7 +5,10 @@
#include <Credentials.h> #include <Credentials.h>
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if(!Credentials::checkCredentialValidity()) return -1; if (!Credentials::checkCredentialValidity()) {
std::cout << "incorrect credentials!" << std::endl;
return -1;
}
if (argc > 1) { if (argc > 1) {
std::string firstarg(argv[1]); std::string firstarg(argv[1]);
if (firstarg == "-h" || firstarg == "--help") { if (firstarg == "-h" || firstarg == "--help") {
@ -28,7 +31,6 @@ int main(int argc, char *argv[]) {
IPRefresher ipr; IPRefresher ipr;
Logger::message("starting check"); Logger::message("starting check");
ipr.checkIPAdress(false); ipr.checkIPAdress(false);
} }
return 0; return 0;