scar-chat7/third_party/CMakeLists.txt

69 lines
1.8 KiB
CMake
Raw Permalink Normal View History

2025-12-07 12:00:44 -07:00
# Third-party dependencies
# These can be added as git submodules or fetched via FetchContent
include(FetchContent)
# JSON library (nlohmann/json)
FetchContent_Declare(
nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.11.3
)
FetchContent_MakeAvailable(nlohmann_json)
# Argon2 password hashing
FetchContent_Declare(
argon2
GIT_REPOSITORY https://github.com/P-H-C/phc-winner-argon2.git
GIT_TAG 20190702
)
FetchContent_GetProperties(argon2)
if(NOT argon2_POPULATED)
FetchContent_Populate(argon2)
# Build argon2 as a C static library (required for the C implementation)
add_library(argon2_lib STATIC
${argon2_SOURCE_DIR}/src/argon2.c
${argon2_SOURCE_DIR}/src/core.c
${argon2_SOURCE_DIR}/src/blake2/blake2b.c
${argon2_SOURCE_DIR}/src/thread.c
${argon2_SOURCE_DIR}/src/encoding.c
${argon2_SOURCE_DIR}/src/opt.c
)
# Disable Qt AUTOMOC/UIC/RCC for this library
set_target_properties(argon2_lib PROPERTIES
AUTOMOC OFF
AUTOUIC OFF
AUTORCC OFF
)
target_include_directories(argon2_lib PUBLIC
${argon2_SOURCE_DIR}/include
${argon2_SOURCE_DIR}/src
)
if(UNIX)
target_link_libraries(argon2_lib PUBLIC pthread)
endif()
endif()
# JWT-CPP for JSON Web Token support (header-only)
FetchContent_Declare(
jwt-cpp
GIT_REPOSITORY https://github.com/Thalhammer/jwt-cpp.git
GIT_TAG v0.7.0
)
FetchContent_GetProperties(jwt-cpp)
if(NOT jwt-cpp_POPULATED)
FetchContent_Populate(jwt-cpp)
# jwt-cpp is header-only, create interface target
add_library(jwt-cpp INTERFACE)
target_include_directories(jwt-cpp INTERFACE ${jwt-cpp_SOURCE_DIR}/include)
target_link_libraries(jwt-cpp INTERFACE OpenSSL::SSL OpenSSL::Crypto)
endif()