This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 5bf3ec2468 Fix missing PCRE includes in CMake by linking to tscore 
(#10073)
5bf3ec2468 is described below

commit 5bf3ec2468045614983758f2857e9eea79c28644
Author: JosiahWI <41302989+josia...@users.noreply.github.com>
AuthorDate: Fri Jul 21 15:12:27 2023 -0500

    Fix missing PCRE includes in CMake by linking to tscore (#10073)
    
    * Add transitive PCRE deps to lots of targets
    
    This fixes all the PCRE include errors I have noticed on Mac.
    
    * Link everything that needs tscore to tscore
    
    This is a step towards getting the dependency tree fixed. And it
    fixes the missing pcre includes.
    
    * Fix build on macOS
    
    - Use -undefined dynamic_lookup to ignore unresolved dependencies which are 
located inside traffic_server
    - Add some missing dependencies
    - Break a cyclic dependency between tscppapi and tscore
    
    * Use target_link_options instead of LINK_FLAGS
    
    * Fix indentation
    
    ---------
    
    Co-authored-by: Mo Chen <moc...@apache.org>
---
 iocore/aio/CMakeLists.txt                 | 2 ++
 iocore/cache/CMakeLists.txt               | 3 ++-
 iocore/dns/CMakeLists.txt                 | 2 ++
 iocore/hostdb/CMakeLists.txt              | 2 ++
 iocore/io_uring/CMakeLists.txt            | 3 ++-
 iocore/net/CMakeLists.txt                 | 9 ++++++++-
 iocore/utils/CMakeLists.txt               | 2 ++
 mgmt/config/CMakeLists.txt                | 2 ++
 mgmt/rpc/CMakeLists.txt                   | 6 ++++++
 plugins/CMakeLists.txt                    | 1 -
 plugins/experimental/slice/CMakeLists.txt | 2 +-
 plugins/s3_auth/CMakeLists.txt            | 2 ++
 proxy/CMakeLists.txt                      | 2 ++
 proxy/http/CMakeLists.txt                 | 2 ++
 proxy/http/remap/CMakeLists.txt           | 2 ++
 proxy/http2/CMakeLists.txt                | 2 ++
 proxy/logging/CMakeLists.txt              | 2 ++
 proxy/shared/CMakeLists.txt               | 2 ++
 src/tscore/CMakeLists.txt                 | 4 ++--
 src/tscpp/api/CMakeLists.txt              | 7 ++++++-
 src/tscpp/util/CMakeLists.txt             | 4 +++-
 21 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/iocore/aio/CMakeLists.txt b/iocore/aio/CMakeLists.txt
index f93e412766..df24884c6d 100644
--- a/iocore/aio/CMakeLists.txt
+++ b/iocore/aio/CMakeLists.txt
@@ -21,3 +21,5 @@ add_library(ts::aio ALIAS aio)
 
 target_sources(aio PRIVATE AIO.cc Inline.cc)
 target_include_directories(aio PRIVATE ${CMAKE_SOURCE_DIR}/iocore/eventsystem 
${CMAKE_SOURCE_DIR}/iocore/io_uring)
+
+target_link_libraries(aio PUBLIC ts::tscore)
diff --git a/iocore/cache/CMakeLists.txt b/iocore/cache/CMakeLists.txt
index 27daa6daf9..ed12d9ebcc 100644
--- a/iocore/cache/CMakeLists.txt
+++ b/iocore/cache/CMakeLists.txt
@@ -53,6 +53,8 @@ target_include_directories(inkcache PRIVATE
 )
 
 target_link_libraries(inkcache
+    PUBLIC
+        ts::tscore
     PRIVATE
         fastlz
         ZLIB::ZLIB
@@ -61,4 +63,3 @@ target_link_libraries(inkcache
 if(HAVE_LZMA_H)
     target_link_libraries(inkcache PRIVATE LibLZMA::LibLZMA)
 endif()
-
diff --git a/iocore/dns/CMakeLists.txt b/iocore/dns/CMakeLists.txt
index 62eedbccbd..96b8793e9b 100644
--- a/iocore/dns/CMakeLists.txt
+++ b/iocore/dns/CMakeLists.txt
@@ -36,3 +36,5 @@ target_include_directories(inkdns PRIVATE
         ${CMAKE_SOURCE_DIR}/proxy/http
         ${CMAKE_SOURCE_DIR}/proxy/hdrs
 )
+
+target_link_libraries(inkdns PUBLIC ts::tscore)
diff --git a/iocore/hostdb/CMakeLists.txt b/iocore/hostdb/CMakeLists.txt
index f4e4c95b11..b0cb7ae2d5 100644
--- a/iocore/hostdb/CMakeLists.txt
+++ b/iocore/hostdb/CMakeLists.txt
@@ -37,3 +37,5 @@ target_include_directories(inkhostdb PRIVATE
         ${CMAKE_SOURCE_DIR}/proxy/http
         ${CMAKE_SOURCE_DIR}/proxy/hdrs
 )
+
+target_link_libraries(inkhostdb PUBLIC ts::tscore)
diff --git a/iocore/io_uring/CMakeLists.txt b/iocore/io_uring/CMakeLists.txt
index 223ed949a5..d83801404a 100644
--- a/iocore/io_uring/CMakeLists.txt
+++ b/iocore/io_uring/CMakeLists.txt
@@ -31,10 +31,11 @@ include_directories(
 add_executable(test_iouring
         unit_tests/test_diskIO.cc)
 target_link_libraries(test_iouring
+    PUBLIC
+        ts::tscore
     PRIVATE
         inkuring
         libswoc
-        ts::tscore
         tscpputil
         uring
 )
diff --git a/iocore/net/CMakeLists.txt b/iocore/net/CMakeLists.txt
index a3fbb97168..86f8c0a351 100644
--- a/iocore/net/CMakeLists.txt
+++ b/iocore/net/CMakeLists.txt
@@ -97,7 +97,7 @@ if(BUILD_REGRESSION_TESTING)
     target_sources(inknet PRIVATE NetVCTest.cc)
 endif()
 
-target_link_libraries(inknet PUBLIC inkevent records)
+
 target_compile_options(inknet PUBLIC -Wno-deprecated-declarations)
 target_include_directories(inknet PUBLIC
         ${CMAKE_SOURCE_DIR}/iocore/eventsystem
@@ -117,6 +117,13 @@ target_include_directories(inknet PUBLIC
         ${YAML_INCLUDE_DIRS}
         )
 
+target_link_libraries(inknet
+    PUBLIC
+        ts::inkevent
+        ts::records
+        ts::tscore
+)
+
 # Fails to link because of circular dep with proxy (ParentSelection)
 # add_executable(test_net unit_tests/test_ProxyProtocol.cc)
 # target_link_libraries(test_net records_p inknet inkevent tscore yaml-cpp 
libswoc)
diff --git a/iocore/utils/CMakeLists.txt b/iocore/utils/CMakeLists.txt
index 87840d4ed9..69c4f6e873 100644
--- a/iocore/utils/CMakeLists.txt
+++ b/iocore/utils/CMakeLists.txt
@@ -31,3 +31,5 @@ target_include_directories(inkutils PRIVATE
         ${CMAKE_SOURCE_DIR}/proxy/http
         ${CMAKE_SOURCE_DIR}/proxy/hdrs
         )
+
+target_link_libraries(inkutils PUBLIC ts::tscore)
diff --git a/mgmt/config/CMakeLists.txt b/mgmt/config/CMakeLists.txt
index 8c7b03a3e3..26b2307179 100644
--- a/mgmt/config/CMakeLists.txt
+++ b/mgmt/config/CMakeLists.txt
@@ -28,3 +28,5 @@ include_directories(
         ${CMAKE_SOURCE_DIR}/proxy/http
         ${IOCORE_INCLUDE_DIRS}
 )
+
+target_link_libraries(configmanager PUBLIC ts::tscore)
diff --git a/mgmt/rpc/CMakeLists.txt b/mgmt/rpc/CMakeLists.txt
index 2f25031df1..e992a79796 100644
--- a/mgmt/rpc/CMakeLists.txt
+++ b/mgmt/rpc/CMakeLists.txt
@@ -33,6 +33,8 @@ add_library(jsonrpc_protocol STATIC
 )
 add_library(ts::jsonrpc_protocol ALIAS jsonrpc_protocol)
 
+target_link_libraries(jsonrpc_protocol PUBLIC ts::tscore)
+
 add_library(jsonrpc_server STATIC
         server/RPCServer.cc
         server/CommBase.cc
@@ -41,6 +43,8 @@ add_library(jsonrpc_server STATIC
 )
 add_library(ts::jsonrpc_server ALIAS jsonrpc_server)
 
+target_link_libraries(jsonrpc_server PUBLIC ts::tscore)
+
 add_library(rpcpublichandlers STATIC
         handlers/common/RecordsUtils.cc
         handlers/config/Configuration.cc
@@ -50,3 +54,5 @@ add_library(rpcpublichandlers STATIC
         handlers/plugins/Plugins.cc
 )
 add_library(ts::rpcpublichandlers ALIAS rpcpublichandlers)
+
+target_link_libraries(rpcpublichandlers PUBLIC ts::tscore)
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index d7f635bed4..4bdc856c44 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -22,7 +22,6 @@ function(add_atsplugin name)
   target_link_libraries(${name} PRIVATE traffic_server)
   set_target_properties(${name} PROPERTIES PREFIX "")
   set_target_properties(${name} PROPERTIES SUFFIX ".so")
-  set_target_properties(${name} PROPERTIES LINK_FLAGS 
"-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib")
   install(TARGETS ${name} DESTINATION libexec/trafficserver)
 endfunction()
 
diff --git a/plugins/experimental/slice/CMakeLists.txt 
b/plugins/experimental/slice/CMakeLists.txt
index 26ec4be731..60d1406d79 100644
--- a/plugins/experimental/slice/CMakeLists.txt
+++ b/plugins/experimental/slice/CMakeLists.txt
@@ -32,7 +32,7 @@ add_atsplugin(slice
     util.cc
 )
 
-target_link_libraries(access_control PRIVATE PCRE::PCRE)
+target_link_libraries(slice PRIVATE ts::tscore)
 
 if(BUILD_TESTING)
     add_subdirectory(unit-tests)
diff --git a/plugins/s3_auth/CMakeLists.txt b/plugins/s3_auth/CMakeLists.txt
index e60d827c30..b0b797e711 100644
--- a/plugins/s3_auth/CMakeLists.txt
+++ b/plugins/s3_auth/CMakeLists.txt
@@ -19,4 +19,6 @@ project(s3_auth)
 
 add_atsplugin(s3_auth s3_auth.cc aws_auth_v4.cc)
 
+target_link_libraries(s3_auth PRIVATE ts::tscore)
+
 add_subdirectory(unit_tests)
diff --git a/proxy/CMakeLists.txt b/proxy/CMakeLists.txt
index 6406c4e31f..2b7f1ddecf 100644
--- a/proxy/CMakeLists.txt
+++ b/proxy/CMakeLists.txt
@@ -58,6 +58,8 @@ target_include_directories(proxy PUBLIC
         ${CMAKE_SOURCE_DIR}/lib/yamlcpp/include
         )
 
+target_link_libraries(proxy PUBLIC ts::tscore)
+
 add_subdirectory(hdrs)
 add_subdirectory(shared)
 add_subdirectory(http)
diff --git a/proxy/http/CMakeLists.txt b/proxy/http/CMakeLists.txt
index 5f919ceb23..5a3d88a24d 100644
--- a/proxy/http/CMakeLists.txt
+++ b/proxy/http/CMakeLists.txt
@@ -56,6 +56,8 @@ target_include_directories(http
         ${YAMLCPP_INCLUDE_DIR}
 )
 
+target_link_libraries(http PUBLIC ts::tscore)
+
 if(TS_USE_QUIC)
     target_link_libraries(http PRIVATE ts::http3)
 endif()
diff --git a/proxy/http/remap/CMakeLists.txt b/proxy/http/remap/CMakeLists.txt
index e2307d81a6..0347de48b6 100644
--- a/proxy/http/remap/CMakeLists.txt
+++ b/proxy/http/remap/CMakeLists.txt
@@ -42,3 +42,5 @@ target_include_directories(http_remap PRIVATE
         ${CMAKE_SOURCE_DIR}/src/records
         ${YAML_INCLUDE_DIRS}
         )
+
+target_link_libraries(http_remap PUBLIC ts::tscore)
diff --git a/proxy/http2/CMakeLists.txt b/proxy/http2/CMakeLists.txt
index 2be773d6fa..c65f5fdc2f 100644
--- a/proxy/http2/CMakeLists.txt
+++ b/proxy/http2/CMakeLists.txt
@@ -36,3 +36,5 @@ target_include_directories(http2 PRIVATE
         ${PROXY_INCLUDE_DIRS}
         ${YAMLCPP_INCLUDE_DIR}
 )
+
+target_link_libraries(http2 PUBLIC ts::tscore)
diff --git a/proxy/logging/CMakeLists.txt b/proxy/logging/CMakeLists.txt
index c3f4acaab7..f5bee95318 100644
--- a/proxy/logging/CMakeLists.txt
+++ b/proxy/logging/CMakeLists.txt
@@ -40,3 +40,5 @@ target_include_directories(logging PRIVATE
         ${YAML_INCLUDE_DIRS}
         ${SWOC_INCLUDE_DIR}
 )
+
+target_link_libraries(logging PUBLIC ts::tscore)
diff --git a/proxy/shared/CMakeLists.txt b/proxy/shared/CMakeLists.txt
index eee5516291..70b853e0d5 100644
--- a/proxy/shared/CMakeLists.txt
+++ b/proxy/shared/CMakeLists.txt
@@ -24,3 +24,5 @@ target_include_directories(diagsconfig PRIVATE
         ${PROXY_INCLUDE_DIRS}
         ${YAMLCPP_INCLUDE_DIR}
 )
+
+target_link_libraries(diagsconfig PUBLIC ts::tscore)
diff --git a/src/tscore/CMakeLists.txt b/src/tscore/CMakeLists.txt
index 76aea94365..a6219108dd 100644
--- a/src/tscore/CMakeLists.txt
+++ b/src/tscore/CMakeLists.txt
@@ -115,11 +115,12 @@ else()
     target_sources(tscore PRIVATE HKDF_openssl.cc)
 endif()
 
+target_link_libraries(tscore PUBLIC PCRE::PCRE)
 if(TS_USE_POSIX_CAP)
     target_link_libraries(tscore PUBLIC cap::cap)
 endif()
 
-add_dependencies(tscore ParseRules tscpputil)
+add_dependencies(tscore ParseRules)
 target_include_directories(tscore PRIVATE
         ${CMAKE_CURRENT_BINARY_DIR}
         ${YAML_INCLUDE_DIRS}
@@ -167,7 +168,6 @@ target_link_libraries(test_tscore
         yaml-cpp::yaml-cpp
         libswoc
         ${OPENSSL_LIBRARIES}
-        PCRE::PCRE
         resolv
         tscpputil
 )
diff --git a/src/tscpp/api/CMakeLists.txt b/src/tscpp/api/CMakeLists.txt
index c31a876bf5..9142712cdb 100644
--- a/src/tscpp/api/CMakeLists.txt
+++ b/src/tscpp/api/CMakeLists.txt
@@ -45,5 +45,10 @@ add_library(ts::tscppapi ALIAS tscppapi)
 target_link_libraries(tscppapi
     PUBLIC
     libswoc
-    yaml-cpp::yaml-cpp)
+    yaml-cpp::yaml-cpp
+)
 install(TARGETS tscppapi)
+
+if(APPLE)
+  target_link_options(tscppapi PRIVATE -undefined dynamic_lookup)
+endif()
diff --git a/src/tscpp/util/CMakeLists.txt b/src/tscpp/util/CMakeLists.txt
index d752b48e7c..26d66a095a 100644
--- a/src/tscpp/util/CMakeLists.txt
+++ b/src/tscpp/util/CMakeLists.txt
@@ -25,7 +25,9 @@ add_library(ts::tscpputil ALIAS tscpputil)
 target_link_libraries(tscpputil
        PUBLIC
                libswoc
-               yaml-cpp::yaml-cpp)
+               yaml-cpp::yaml-cpp
+                ts::tscore
+)
 install(TARGETS tscpputil)
 
 add_executable(test_tscpputil

Reply via email to