You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.0 KiB
59 lines
2.0 KiB
project(telegram_bog) |
|
cmake_minimum_required(VERSION 3.17.0) |
|
|
|
set(CMAKE_CXX_STANDARD 17) |
|
set(CMAKE_CXX_STANDARD_REQUIRED ON) |
|
|
|
#set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") |
|
#set(BUILD_SHARED_LIBS OFF) |
|
#set(CMAKE_EXE_LINKER_FLAGS "-static") |
|
|
|
set(CMAKE_BUILD_TYPE "Debug") |
|
|
|
set (CMAKE_CXX_FLAGS" ${CMAKE_CXX_FLAGS} -DSPDLOG_COMPILED_LIB -DSQLITE_OMIT_LOAD_EXTENSION -static-libasan -g") |
|
set (CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -DSPDLOG_COMPILED_LIB -DSQLITE_OMIT_LOAD_EXTENSION -static-libasan") |
|
|
|
|
|
include(FetchContent) |
|
FetchContent_Declare(json |
|
GIT_REPOSITORY https://github.com/nlohmann/json.git |
|
GIT_TAG v3.7.3) |
|
|
|
FetchContent_GetProperties(json) |
|
if(NOT json_POPULATED) |
|
FetchContent_Populate(json) |
|
add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL) |
|
endif() |
|
|
|
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/whoshuu/cpr.git GIT_TAG c8d33915dbd88ad6c92b258869b03aba06587ff9) # the commit hash for 1.5.0 |
|
FetchContent_MakeAvailable(cpr) |
|
|
|
project(echobot-submodule) |
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") |
|
set(Boost_USE_MULTITHREADED ON) |
|
|
|
find_package(Threads REQUIRED) |
|
find_package(OpenSSL REQUIRED) |
|
find_package(Boost COMPONENTS system REQUIRED) |
|
include_directories(/usr/local/include ${OPENSSL_INCLUDE_DIR} |
|
${Boost_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/lib/spdlog/include |
|
${CMAKE_SOURCE_DIR}/lib/tgbot-cpp/include) |
|
|
|
if (CURL_FOUND) |
|
include_directories(${CURL_INCLUDE_DIRS}) |
|
add_definitions(-DHAVE_CURL) |
|
endif() |
|
|
|
file(GLOB_RECURSE src_files CONFIGURE_DEPENDS "src/*.h" "src/*.cpp") |
|
add_executable(telegram_bog ${src_files} lib/sqlite3.c) |
|
|
|
#set(OPENSSL_USE_STATIC_LIBS TRUE) |
|
|
|
target_link_libraries(telegram_bog PRIVATE |
|
${CMAKE_SOURCE_DIR}/lib/tgbot-cpp/build/libTgBot.a ${CMAKE_THREAD_LIBS_INIT} |
|
${OPENSSL_LIBRARIES} ${Boost_LIBRARIES} ${CURL_LIBRARIES}) |
|
target_link_libraries(telegram_bog PRIVATE nlohmann_json::nlohmann_json) |
|
target_link_libraries(telegram_bog PRIVATE cpr::cpr) |
|
target_link_libraries(telegram_bog PRIVATE ${CMAKE_SOURCE_DIR}/lib/spdlog/build/libspdlog.a) |
|
|
|
|