Skip to content

Commit 49f525e

Browse files
authored
Merge pull request #270 from r4d1sh/cmake
Improvements for CMake rules
2 parents c9ebca6 + d841f0e commit 49f525e

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
cmake_minimum_required(VERSION 3.10.2)
22
project(TgBot)
33

4+
if(POLICY CMP0074)
5+
cmake_policy(SET CMP0074 NEW) # find_package() uses <PackageName>_ROOT variables
6+
endif()
7+
48
# options
59
option(ENABLE_TESTS "Set to ON to enable building of tests" OFF)
610
option(BUILD_SHARED_LIBS "Build tgbot-cpp shared/static library." OFF)
@@ -12,6 +16,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
1216
set(CMAKE_CXX_EXTENSIONS OFF)
1317
if(WIN32)
1418
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
19+
add_definitions(-D_WIN32_WINNT=0x0601)
20+
add_definitions(-DWIN32_LEAN_AND_MEAN)
21+
add_definitions(-DNOMINMAX)
1522
else()
1623
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
1724
endif()
@@ -75,9 +82,12 @@ set(LIB_LIST
7582
${ZLIB_LIBRARIES}
7683
${OPENSSL_LIBRARIES}
7784
${Boost_LIBRARIES}
78-
${CURL_LIBRARIES}
7985
)
8086

87+
if (CURL_FOUND)
88+
set(LIB_LIST ${LIB_LIST} ${CURL_LIBRARIES})
89+
endif()
90+
8191
# building project
8292
add_library(${PROJECT_NAME} ${SRC_LIST})
8393
target_include_directories(${PROJECT_NAME} PUBLIC include)

0 commit comments

Comments
 (0)