pixwhile/CMakeLists.txt

40 lines
1.6 KiB
CMake
Raw Normal View History

2023-04-10 14:00:07 +00:00
cmake_minimum_required(VERSION 3.16)
2023-04-03 08:57:51 +00:00
2023-06-08 16:02:36 +00:00
project(pixwhile C CXX)
2023-04-03 08:57:51 +00:00
find_package(nlohmann_json REQUIRED)
set(HTTPLIB_REQUIRE_OPENSSL ON)
add_subdirectory(thirdparty/httplib)
2023-06-08 16:02:36 +00:00
find_package(PkgConfig REQUIRED)
pkg_check_modules(HIREDIS REQUIRED hiredis)
2023-04-03 08:57:51 +00:00
if (CMAKE_BUILD_TYPE MATCHES "Debug")
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)
endif()
# https://t.me/NightShadowsHangout/670691
list(APPEND FLAGS -Werror -Wall -Wextra -Wshadow -Wpedantic -Wno-gnu-anonymous-struct -fPIC -fno-rtti -Wconversion -Wno-unused-parameter -Wimplicit-fallthrough)
# i have no idea why this hack wasn't needed before but it's needed if sanitizers are used
add_link_options(${FLAGS})
2023-06-08 16:02:36 +00:00
add_executable(${PROJECT_NAME} main.cpp misc.cpp config.cpp servehelper.cpp numberhelper.cpp pixivclient.cpp pixivmodels.cpp hiredis_wrapper.cpp
routes/home.cpp routes/css.cpp routes/artworks.cpp routes/tags.cpp routes/guess_extension.cpp routes/users/common.cpp routes/users/illustrations.cpp
blankie/serializer.cpp blankie/escape.cpp blankie/unescape.cpp blankie/murl.cpp)
2023-04-03 08:57:51 +00:00
set_target_properties(${PROJECT_NAME}
PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
2023-06-08 16:02:36 +00:00
target_include_directories(${PROJECT_NAME} PRIVATE thirdparty ${HIREDIS_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json::nlohmann_json httplib::httplib ${HIREDIS_LINK_LIBRARIES})
2023-04-03 08:57:51 +00:00
target_compile_options(${PROJECT_NAME} PRIVATE ${FLAGS})