You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "JosiahWI (via GitHub)" <gi...@apache.org> on 2023/07/12 23:33:54 UTC

[GitHub] [trafficserver] JosiahWI commented on a diff in pull request #9974: Switch libtscore to static and deal with the fallout

JosiahWI commented on code in PR #9974:
URL: https://github.com/apache/trafficserver/pull/9974#discussion_r1261819002


##########
src/traffic_server/CMakeLists.txt:
##########
@@ -80,6 +80,9 @@ endif (TS_USE_LINUX_IO_URING)
 if (TS_USE_LINUX_NATIVE_AIO)
     target_link_libraries(traffic_server PRIVATE aio)
 endif (TS_USE_LINUX_NATIVE_AIO)
+if(TS_USE_POSIX_CAP)
+    target_link_libraries(traffic_server PUBLIC cap::cap)
+endif()

Review Comment:
   I don't think traffic_server has a direct dependency on libpcap, so it should not be linked here. Let CMake take care of resolving the transitive dependencies.
   
   ```cmake
   add_library(dependency dependency.cc)
   
   target_link_libraries(dependency PUBLIC transitive::transitive)
   
   add_executable(main main.cc)
   
   target_link_libraries(main PRIVATE dependency)
   ```
   
   CMake will link main to transitive::transitive if dependency is STATIC; if dependency is SHARED, then include paths for transitive::transitive will be added to main, but the library will not be linked.
   
   This is the ideal. We can't do it everywhere in ATS yet because our dependency graph is a nightmare; if we really have to link directly to the transitive dependency for now, let's mark it so we know it should be fixed later.
   
   This applies to a number of targets changed in this PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org