cleanup in cmake file (added libraries)

code reformats
This commit is contained in:
max mustermann 2019-08-01 20:18:39 +02:00
parent c5b5029cb1
commit 904cd2e96a
4 changed files with 23 additions and 15 deletions

View File

@ -1,30 +1,38 @@
cmake_minimum_required(VERSION 3.7) 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) find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIR}) include_directories(${CURL_INCLUDE_DIR})
add_library(api
set(SOURCE
src/main.cpp
src/api/API.h src/api/API.h
src/api/API.cpp src/api/API.cpp
src/api/Hashmap.h src/api/Hashmap.h
src/Logger.cpp
src/Logger.h
src/api/TelegramAPI.cpp src/api/TelegramAPI.cpp
src/api/TelegramAPI.h src/api/TelegramAPI.h
src/api/DynuAPI.cpp 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}) add_executable(iprefresher ${SOURCE})
target_link_libraries(iprefresher ${CURL_LIBRARIES}) target_link_libraries(iprefresher api logger ${CURL_LIBRARIES} )
install (TARGETS iprefresher DESTINATION bin) install (TARGETS iprefresher DESTINATION bin)

View File

@ -26,7 +26,7 @@ API::request(std::string myurl, bool post, Hashmap<std::string, std::string> &ma
struct curl_slist *list = nullptr; struct curl_slist *list = nullptr;
for (int j = 0; j < headers.size(); ++j) { 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; std::string readString;

View File

@ -43,7 +43,7 @@ valuetype Hashmap<keytype, valuetype>::getValue(int position) {
template<class keytype, class valuetype> template<class keytype, class valuetype>
int Hashmap<keytype, valuetype>::size() { int Hashmap<keytype, valuetype>::size() {
return (int)(keys.size()); return (int) (keys.size());
} }

View File

@ -43,10 +43,10 @@ int main(int argc, char *argv[]) {
DynuAPI dynu; DynuAPI dynu;
if(dynu.refreshIp(ip)){ if (dynu.refreshIp(ip)) {
TelegramAPI tele; TelegramAPI tele;
tele.sendMessage(oldip + " moved to " + ip); tele.sendMessage(oldip + " moved to " + ip);
} else{ } else {
//error //error
logger.logToLogfile(" [ERROR] failed to write ip to dynu api!"); logger.logToLogfile(" [ERROR] failed to write ip to dynu api!");
} }