summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt12
-rw-r--r--src/net/BoostHttpOnlySslClient.cpp2
-rw-r--r--src/tools/StringTools.cpp2
3 files changed, 13 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b50b03a..290d201 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,10 @@
cmake_minimum_required(VERSION 3.10.2)
project(TgBot)
+if(POLICY CMP0074)
+ cmake_policy(SET CMP0074 NEW) # find_package() uses <PackageName>_ROOT variables
+endif()
+
# options
option(ENABLE_TESTS "Set to ON to enable building of tests" OFF)
option(BUILD_SHARED_LIBS "Build tgbot-cpp shared/static library." OFF)
@@ -12,6 +16,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+ add_definitions(-D_WIN32_WINNT=0x0601)
+ add_definitions(-DWIN32_LEAN_AND_MEAN)
+ add_definitions(-DNOMINMAX)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
@@ -75,9 +82,12 @@ set(LIB_LIST
${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES}
${Boost_LIBRARIES}
- ${CURL_LIBRARIES}
)
+if (CURL_FOUND)
+ set(LIB_LIST ${LIB_LIST} ${CURL_LIBRARIES})
+endif()
+
# building project
add_library(${PROJECT_NAME} ${SRC_LIST})
target_include_directories(${PROJECT_NAME} PUBLIC include)
diff --git a/src/net/BoostHttpOnlySslClient.cpp b/src/net/BoostHttpOnlySslClient.cpp
index 82bd897..30279e6 100644
--- a/src/net/BoostHttpOnlySslClient.cpp
+++ b/src/net/BoostHttpOnlySslClient.cpp
@@ -59,7 +59,7 @@ string BoostHttpOnlySslClient::makeRequest(const Url& url, const vector<HttpReqA
// We'll need to get the underlying native socket for this select call, in order
// to add a simple timeout on the read:
- int nativeSocket = socket.lowest_layer().native_handle();
+ int nativeSocket = static_cast<int>(socket.lowest_layer().native_handle());
FD_SET(nativeSocket,&fileDescriptorSet);
select(nativeSocket+1,&fileDescriptorSet,NULL,NULL,&timeStruct);
diff --git a/src/tools/StringTools.cpp b/src/tools/StringTools.cpp
index 3e5e6c4..cc5436f 100644
--- a/src/tools/StringTools.cpp
+++ b/src/tools/StringTools.cpp
@@ -63,7 +63,7 @@ string generateRandomString(std::size_t length) {
random_device randomDevice;
mt19937 randomSeed(randomDevice());
- uniform_int_distribution<int> generator(0, charsLen - 1);
+ uniform_int_distribution<std::size_t> generator(0, charsLen - 1);
for (std::size_t i = 0; i < length; ++i) {
result += chars[generator(randomSeed)];