add_library(tsg-http src/tsg_logger.cpp src/tsg_http.cpp src/pattern_replace.cpp src/tsg_web_cache.cpp src/edit_element.cpp src/http_lua.cpp)
target_include_directories(tsg-http PRIVATE ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(tsg-http PUBLIC common http tango-cache-client)
target_link_libraries(tsg-http PUBLIC rdkafka ctemplate-static cjson pcre2-static ratelimiter-static libdablooms pthread)
target_link_libraries(tsg-http PUBLIC maatframe tsglua)
target_link_libraries(tsg-http PUBLIC libxml2-static z)

add_executable(test_pattern_replace test/test_pattern_replace.cpp src/pattern_replace.cpp)
target_include_directories(test_pattern_replace PRIVATE ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(test_pattern_replace common gtest pcre2-static)
file(COPY test/test_data DESTINATION ./)

add_executable(test_edit_element test/test_edit_element.cpp src/edit_element.cpp)
target_include_directories(test_edit_element PRIVATE ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(test_edit_element common gtest pcre2-static libxml2-static z)

add_executable(test_http_lua test/test_http_lua.cpp src/http_lua.cpp)
target_include_directories(test_http_lua PRIVATE ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(test_http_lua common gtest tsglua z)

add_executable(replace_tool test/replace_tool.cpp src/pattern_replace.cpp)
target_include_directories(replace_tool PRIVATE ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(replace_tool common pcre2-static)
