summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorOleg Morozenkov <m@oleg.rocks>2018-07-23 01:56:42 +0300
committerOleg Morozenkov <m@oleg.rocks>2018-07-23 01:56:42 +0300
commitd47ee877be5d1175bdc36f2d87881ddaf875a8e9 (patch)
tree7fd20cdc1236fe6b832ae980de12afd7071ebab9 /CMakeLists.txt
parentcea20d4078f2088dea0dd589f1cc9dd7ee22461b (diff)
Refactor http clients, fix webhook server, add more samples, change tabs to 4 spaces
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt65
1 files changed, 33 insertions, 32 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 236acbb..a6d5c2e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,68 +1,69 @@
cmake_minimum_required(VERSION 2.8.4)
project(TgBot)
-### options
+# options
option(ENABLE_TESTS "Set to ON to enable building of tests" OFF)
option(BUILD_SHARED_LIBS "Build tgbot-cpp shared/static library." OFF)
-### sources
+# sources
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
include_directories(include)
set(SRC_LIST
- src/Api.cpp
- src/TgTypeParser.cpp
- src/TgException.cpp
- src/EventHandler.cpp
- src/net/Url.cpp
- src/net/HttpClient.cpp
- src/net/HttpParser.cpp
- src/net/TgLongPoll.cpp
- src/tools/StringTools.cpp
- src/tools/FileTools.cpp
- src/types/InlineQueryResult.cpp
- src/types/InputFile.cpp
+ src/Api.cpp
+ src/EventHandler.cpp
+ src/TgException.cpp
+ src/TgTypeParser.cpp
+ src/net/BoostHttpOnlySslClient.cpp
+ src/net/CurlHttpClient.cpp
+ src/net/HttpParser.cpp
+ src/net/TgLongPoll.cpp
+ src/net/Url.cpp
+ src/tools/FileTools.cpp
+ src/tools/StringTools.cpp
+ src/types/InlineQueryResult.cpp
+ src/types/InputFile.cpp
)
-### libs
-# threads
+# libs
+## threads
find_package(Threads REQUIRED)
-# openssl
+## openssl
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
-# curl
+## curl
find_package(CURL)
if (CURL_FOUND)
-include_directories(${CURL_INCLUDE_DIRS})
-add_definitions(-DHAVE_CURL)
+ include_directories(${CURL_INCLUDE_DIRS})
+ add_definitions(-DHAVE_CURL)
endif()
-# boost
+## boost
set(Boost_USE_MULTITHREADED ON)
if (ENABLE_TESTS)
- find_package(Boost 1.59.0 COMPONENTS system unit_test_framework REQUIRED)
+ find_package(Boost 1.59.0 COMPONENTS system unit_test_framework REQUIRED)
else()
- find_package(Boost 1.59.0 COMPONENTS system REQUIRED)
+ find_package(Boost 1.59.0 COMPONENTS system REQUIRED)
endif()
include_directories(${Boost_INCLUDE_DIR})
set(LIB_LIST
- ${CMAKE_THREAD_LIBS_INIT}
- ${OPENSSL_LIBRARIES}
- ${Boost_LIBRARIES}
- ${CURL_LIBRARIES}
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${OPENSSL_LIBRARIES}
+ ${Boost_LIBRARIES}
+ ${CURL_LIBRARIES}
)
-### building project
+# building project
add_library(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} ${LIB_LIST})
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
install(DIRECTORY include/ DESTINATION include)
-### tests
+# tests
if (ENABLE_TESTS)
- message(STATUS "Building of tests is enabled")
- enable_testing()
- add_subdirectory(test)
+ message(STATUS "Building of tests is enabled")
+ enable_testing()
+ add_subdirectory(test)
endif()