aux_source_directory(${PROJECT_SOURCE_DIR}/deps/toml DEPS_SRC)
aux_source_directory(${PROJECT_SOURCE_DIR}/deps/md5 DEPS_SRC)

add_library(http_test SHARED http_test_plug.cpp ${DEPS_SRC})
add_dependencies(http_test http)
target_link_libraries(http_test cjson-static llhttp-static)
set_target_properties(http_test PROPERTIES PREFIX "")

include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/deps)
include_directories(${PROJECT_SOURCE_DIR}/decoders/http)
include_directories(${PROJECT_SOURCE_DIR}/include/stellar)

add_executable(gtest_http http_gtest.cpp ${PROJECT_SOURCE_DIR}/decoders/http/http_decoder_utils.c ${PROJECT_SOURCE_DIR}/decoders/http/http_content_decompress.c ${PROJECT_SOURCE_DIR}/deps/md5/md5.c)
target_link_libraries(gtest_http gtest stellar_lib llhttp-static z brotli-dec-static brotli-enc-static  brotli-common-static libevent-static)

add_executable(http_test_main plugin_test_main.cpp)
set_target_properties(http_test_main 
    PROPERTIES 
    LINK_OPTIONS 
    "-rdynamic" 
    )
set_target_properties(http_test_main 
    PROPERTIES 
    LINK_FLAGS  
    "-rdynamic" 
    )
set(LINK_FLAGS "-rdynamic")
target_link_libraries(http_test_main gtest cjson-static stellar_lib llhttp-static)

add_subdirectory(test_based_on_stellar)

include(GoogleTest)
gtest_discover_tests(gtest_http)
