Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
cmake_minimum_required(VERSION 3.16)
project(absmartly-sdk VERSION 1.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(FetchContent)

FetchContent_Declare(
json
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
)
FetchContent_MakeAvailable(json)

add_library(absmartly-sdk
src/md5.cpp
src/murmur3.cpp
src/variant_assigner.cpp
src/utils.cpp
src/context.cpp
src/client.cpp
src/default_context_data_provider.cpp
src/default_context_event_publisher.cpp
src/sdk.cpp
src/json_expr/evaluator.cpp
src/json_expr/operators.cpp
src/audience_matcher.cpp
)

target_include_directories(absmartly-sdk PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

target_link_libraries(absmartly-sdk PUBLIC nlohmann_json::nlohmann_json)

find_package(CURL QUIET)
if(CURL_FOUND)
target_sources(absmartly-sdk PRIVATE src/default_http_client.cpp)
target_compile_definitions(absmartly-sdk PUBLIC ABSMARTLY_HAVE_CURL)
target_link_libraries(absmartly-sdk PRIVATE CURL::libcurl)
message(STATUS "ABsmartly: CURL found, DefaultHTTPClient enabled")
else()
message(STATUS "ABsmartly: CURL not found, DefaultHTTPClient disabled")
endif()

option(ABSMARTLY_BUILD_TESTS "Build tests" ON)
if(ABSMARTLY_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
Loading