This is an automated email from the ASF dual-hosted git repository. dragon pushed a commit to branch dragon512-patch-1 in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 7c79ccd89caefa3fe7f74867d450699cb792772d Author: Jason Kenny <dragon...@live.com> AuthorDate: Mon Nov 6 15:41:13 2023 -0600 Standardize maxminddb package_find() Allow plugin to build if required library exists format --- CMakeLists.txt | 3 +++ plugins/experimental/maxmind_acl/CMakeLists.txt | 12 ++++++++---- plugins/header_rewrite/CMakeLists.txt | 2 -- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e50734a5b..e1f1541237 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -328,6 +328,9 @@ if(ENABLE_QUICHE) endif() endif() +# for the plugin system +find_package(maxminddb) # Header_rewrite experimental/maxmind_acl + if(ENABLE_ASAN) add_compile_options(-fsanitize=address) add_link_options(-fsanitize=address) diff --git a/plugins/experimental/maxmind_acl/CMakeLists.txt b/plugins/experimental/maxmind_acl/CMakeLists.txt index 66d5cd7b42..02c4ca252c 100644 --- a/plugins/experimental/maxmind_acl/CMakeLists.txt +++ b/plugins/experimental/maxmind_acl/CMakeLists.txt @@ -15,10 +15,14 @@ # ####################### -add_atsplugin(maxmind_acl maxmind_acl.cc mmdb.cc) +if(maxminddb_FOUND) -target_include_directories(maxmind_acl PRIVATE ${PCRE_INCLUDE_DIR}) + add_atsplugin(maxmind_acl maxmind_acl.cc mmdb.cc) -find_package(maxminddb REQUIRED) + target_include_directories(maxmind_acl PRIVATE ${PCRE_INCLUDE_DIR}) -target_link_libraries(maxmind_acl PRIVATE libswoc yaml-cpp::yaml-cpp maxminddb::maxminddb) + target_link_libraries(maxmind_acl PRIVATE libswoc yaml-cpp::yaml-cpp maxminddb::maxminddb) + +else() + message(STATUS "skipping maxmind_acl plugin (missing maxminddb)") +endif() diff --git a/plugins/header_rewrite/CMakeLists.txt b/plugins/header_rewrite/CMakeLists.txt index 2efe0ae68a..3995654675 100644 --- a/plugins/header_rewrite/CMakeLists.txt +++ b/plugins/header_rewrite/CMakeLists.txt @@ -36,8 +36,6 @@ add_library(header_rewrite_parser STATIC parser.cc) target_link_libraries(header_rewrite PRIVATE PCRE::PCRE libswoc) -find_package(maxminddb QUIET) - if(maxminddb_FOUND) target_sources(header_rewrite PRIVATE conditions_geo_maxmind.cc) target_link_libraries(header_rewrite PRIVATE maxminddb::maxminddb)