diff --git a/CMakeLists.txt b/CMakeLists.txt index c0aad81..0a507f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,30 +1,38 @@ cmake_minimum_required(VERSION 3.7) -project(iprefresher) +project(iprefresher VERSION 1.0.1 DESCRIPTION "mylib description") -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) find_package(CURL REQUIRED) include_directories(${CURL_INCLUDE_DIR}) - -set(SOURCE - src/main.cpp - +add_library(api src/api/API.h src/api/API.cpp src/api/Hashmap.h - src/Logger.cpp - src/Logger.h - src/api/TelegramAPI.cpp src/api/TelegramAPI.h src/api/DynuAPI.cpp - src/api/DynuAPI.h src/api/IPAPI.cpp src/api/IPAPI.h) + src/api/DynuAPI.h + + src/api/IPAPI.cpp + src/api/IPAPI.h + ) + +add_library(logger + src/Logger.cpp + src/Logger.h + ) + + +set(SOURCE + src/main.cpp + ) add_executable(iprefresher ${SOURCE}) -target_link_libraries(iprefresher ${CURL_LIBRARIES}) +target_link_libraries(iprefresher api logger ${CURL_LIBRARIES} ) install (TARGETS iprefresher DESTINATION bin) diff --git a/src/api/API.cpp b/src/api/API.cpp index de05fcb..f934fd7 100644 --- a/src/api/API.cpp +++ b/src/api/API.cpp @@ -26,7 +26,7 @@ API::request(std::string myurl, bool post, Hashmap &ma struct curl_slist *list = nullptr; for (int j = 0; j < headers.size(); ++j) { - list = curl_slist_append(list, headers.at((unsigned long)(j)).c_str()); + list = curl_slist_append(list, headers.at((unsigned long) (j)).c_str()); } std::string readString; diff --git a/src/api/Hashmap.h b/src/api/Hashmap.h index 34abdac..443bc6b 100644 --- a/src/api/Hashmap.h +++ b/src/api/Hashmap.h @@ -43,7 +43,7 @@ valuetype Hashmap::getValue(int position) { template int Hashmap::size() { - return (int)(keys.size()); + return (int) (keys.size()); } diff --git a/src/main.cpp b/src/main.cpp index f15abe6..a99b777 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,10 +43,10 @@ int main(int argc, char *argv[]) { DynuAPI dynu; - if(dynu.refreshIp(ip)){ + if (dynu.refreshIp(ip)) { TelegramAPI tele; tele.sendMessage(oldip + " moved to " + ip); - } else{ + } else { //error logger.logToLogfile(" [ERROR] failed to write ip to dynu api!"); }