crowsite/CMakeLists.txt

77 lines
2.2 KiB
CMake
Raw Normal View History

2023-06-25 17:36:11 -04:00
cmake_minimum_required(VERSION 3.0)
project(crowsite VERSION 0.0.1)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF)
set(CMAKE_CXX_STANDARD 20)
set(CROW_FEATURES compression)
2023-08-16 20:15:34 -04:00
cmake_policy(SET CMP0057 NEW)
#find_package(Crow)
2023-08-29 11:48:55 -04:00
set(PRECOMPILED_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/crowsite/crow_pch.h")
set(CROW_BUILD_TESTS OFF)
set(CROW_BUILD_EXAMPLES OFF)
set(CROW_INSTALL OFF)
add_subdirectory(libs/crow)
2023-08-09 21:56:11 -04:00
find_package(CURL)
2023-08-16 01:24:22 -04:00
find_package(OpenSSL)
2023-08-18 02:21:39 -04:00
find_package(SQLite3)
2023-08-16 01:24:22 -04:00
message("SSL ${OPENSSL_INCLUDE_DIR}")
2023-08-18 02:21:39 -04:00
if (NOT SQLite3_FOUND)
message("Failed to find SQLite3")
endif ()
message("SQLite ${SQLite3_INCLUDE_DIRS} ${SQLite3_LIBRARIES}")
2023-08-09 21:56:11 -04:00
if (NOT CURL_FOUND)
message("libcurl is required!")
else ()
message("${CURL_INCLUDE_DIRS} || ${CURL_LIBRARIES}")
endif ()
2023-06-25 17:36:11 -04:00
add_subdirectory(libs/BLT)
2023-08-27 19:18:16 -04:00
add_subdirectory(libs/md4c)
2023-06-25 17:36:11 -04:00
include_directories(include/)
2023-08-09 21:56:11 -04:00
include_directories(${CURL_INCLUDE_DIRS})
2023-08-18 02:21:39 -04:00
include_directories(${SQLite3_INCLUDE_DIRS})
include_directories(${OPENSSL_INCLUDE_DIR})
2023-06-25 17:36:11 -04:00
file(GLOB_RECURSE source_files src/*.cpp)
2023-08-29 11:48:55 -04:00
add_executable(crowsite ${source_files} ${PRECOMPILED_HEADER})
2023-06-25 17:36:11 -04:00
target_compile_definitions(crowsite PUBLIC CROW_ENABLE_COMPRESSION)
2023-06-25 17:36:11 -04:00
target_link_libraries(crowsite BLT)
target_link_libraries(crowsite Crow::Crow)
2023-08-09 21:56:11 -04:00
target_link_libraries(crowsite ${CURL_LIBRARIES})
2023-08-16 01:24:22 -04:00
target_link_libraries(crowsite OpenSSL::SSL OpenSSL::Crypto)
2023-08-18 02:21:39 -04:00
target_link_libraries(crowsite SQLite::SQLite3)
2023-08-27 19:18:16 -04:00
target_link_libraries(crowsite md4c-html md4c)
target_include_directories(crowsite PRIVATE libs/md4c/src)
2023-06-25 17:36:11 -04:00
target_compile_options(crowsite PRIVATE -Wall -Wextra -Wpedantic)
if (${ENABLE_ADDRSAN} MATCHES ON)
target_compile_options(crowsite PRIVATE -fsanitize=address)
target_link_options(crowsite PRIVATE -fsanitize=address)
endif ()
if (${ENABLE_UBSAN} MATCHES ON)
target_compile_options(crowsite PRIVATE -fsanitize=undefined)
target_link_options(crowsite PRIVATE -fsanitize=undefined)
endif ()
if (${ENABLE_TSAN} MATCHES ON)
target_compile_options(crowsite PRIVATE -fsanitize=thread)
target_link_options(crowsite PRIVATE -fsanitize=thread)
endif ()
2023-08-29 11:48:55 -04:00
target_precompile_headers(crowsite PRIVATE ${PRECOMPILED_HEADER})