discord-bot/CMakeLists.txt

43 lines
1.4 KiB
CMake
Raw Normal View History

2024-02-22 16:09:56 -05:00
cmake_minimum_required(VERSION 3.27)
project(discord_bot)
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 17)
2024-02-25 14:05:45 -05:00
add_compile_options(-march=native)
set(SQLITE_ORM_ENABLE_CXX_17 ON)
2024-02-22 16:09:56 -05:00
add_subdirectory(libs/blt)
add_subdirectory(libs/DPP-10.0.29)
2024-02-25 14:05:45 -05:00
add_subdirectory(libs/sqlite_orm-1.8.2)
2024-02-22 16:09:56 -05:00
include_directories(include/)
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
add_executable(discord_bot ${PROJECT_BUILD_FILES})
2024-02-25 14:05:45 -05:00
target_compile_options(discord_bot PUBLIC -Wall -Wpedantic -Wno-comment -march=native)
target_link_options(discord_bot PUBLIC -Wall -Wpedantic -Wno-comment)
2024-02-22 16:09:56 -05:00
target_link_libraries(discord_bot PUBLIC BLT)
target_link_libraries(discord_bot PUBLIC dpp)
2024-02-25 14:05:45 -05:00
target_link_libraries(discord_bot PUBLIC sqlite_orm)
2024-02-22 16:09:56 -05:00
if (${ENABLE_ADDRSAN} MATCHES ON)
target_compile_options(discord_bot PRIVATE -fsanitize=address)
target_link_options(discord_bot PRIVATE -fsanitize=address)
endif ()
if (${ENABLE_UBSAN} MATCHES ON)
target_compile_options(discord_bot PRIVATE -fsanitize=undefined)
target_link_options(discord_bot PRIVATE -fsanitize=undefined)
endif ()
if (${ENABLE_TSAN} MATCHES ON)
target_compile_options(discord_bot PRIVATE -fsanitize=thread)
target_link_options(discord_bot PRIVATE -fsanitize=thread)
endif ()