coyote/CMakeLists.txt

45 lines
1.8 KiB
CMake
Raw Normal View History

2023-11-22 08:39:24 +00:00
cmake_minimum_required(VERSION 3.16)
project(coyote C CXX)
find_package(nlohmann_json REQUIRED)
find_package(CURL REQUIRED)
set(HTTPLIB_REQUIRE_OPENSSL ON)
add_subdirectory(thirdparty/httplib)
2023-11-22 23:27:44 +00:00
set(LEXBOR_BUILD_SHARED OFF)
add_subdirectory(thirdparty/lexbor)
2023-11-25 03:39:35 +00:00
find_package(PkgConfig REQUIRED)
pkg_check_modules(HIREDIS REQUIRED hiredis)
2023-11-22 08:39:24 +00:00
if (CMAKE_BUILD_TYPE MATCHES "Debug|RelWithDebInfo")
2023-11-22 08:39:24 +00:00
if (NOT FLAGS)
list(APPEND FLAGS -fsanitize=undefined,thread)
endif()
# https://sourceforge.net/p/valgrind/mailman/valgrind-users/thread/Ygze8PzaQAYWlKDj%40wildebeest.org/
list(APPEND FLAGS -gdwarf-4)
list(APPEND DEFINITIONS JSON_DIAGNOSTICS=1)
2023-11-22 08:39:24 +00:00
endif()
# https://t.me/NightShadowsHangout/670691
2023-12-04 04:42:30 +00:00
list(APPEND FLAGS -Werror -Wall -Wextra -Wshadow -Wpedantic -Wno-gnu-anonymous-struct -Wno-missing-field-initializers -fPIC -fno-rtti -Wconversion -Wno-unused-parameter -Wimplicit-fallthrough)
2023-11-22 08:39:24 +00:00
# i have no idea why this hack wasn't needed before but it's needed if sanitizers are used
add_link_options(${FLAGS})
add_executable(${PROJECT_NAME} main.cpp numberhelper.cpp config.cpp settings.cpp models.cpp client.cpp servehelper.cpp timeutils.cpp hiredis_wrapper.cpp
routes/home.cpp routes/css.cpp routes/user.cpp routes/status.cpp routes/tags.cpp routes/about.cpp routes/user_settings.cpp
2023-11-22 08:39:24 +00:00
blankie/serializer.cpp blankie/escape.cpp)
set_target_properties(${PROJECT_NAME}
PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
target_include_directories(${PROJECT_NAME} PRIVATE thirdparty ${HIREDIS_INCLUDE_DIRS})
2023-11-22 23:27:44 +00:00
target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json::nlohmann_json CURL::libcurl httplib::httplib lexbor_static ${HIREDIS_LINK_LIBRARIES})
target_compile_definitions(${PROJECT_NAME} PRIVATE ${DEFINITIONS})
2023-11-22 08:39:24 +00:00
target_compile_options(${PROJECT_NAME} PRIVATE ${FLAGS})