diff options
author | João Valverde <j@v6e.pt> | 2023-02-12 20:30:38 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2023-02-12 20:30:38 +0000 |
commit | ce6c3da7278a63241caeff793cb64189e85a2a0b (patch) | |
tree | 4d5738067525a6ebff1bcd1085dc8b42511d1b30 /CMakeLists.txt | |
parent | 58a80312cb668e1cdbe7ba47d15593613db369fb (diff) |
Revert "Enable rpathification and working relocation on Linux (take 2)"
This reverts commit 8dfe8737c554b4e4b2b48b994290a75c261e0f11
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 62 |
1 files changed, 22 insertions, 40 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1149fcb3e9..d3aae7135b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -270,25 +270,26 @@ if(NOT (WIN32 OR APPLE OR USE_STATIC)) # Some systems support $ORIGIN in RPATH to enable relocatable # binaries. In other cases, only absolute paths can be used. # https://www.lekensteyn.nl/rpath.html - # - # Also note that some systems (notably those using GNU libc) - # silently ignore $ORIGIN in RPATH for binaries that are - # setuid root or use privileged capabilities. - # if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|SunOS|FreeBSD)$") set(_enable_rpath_origin TRUE) + if(BUILD_dumpcap AND ENABLE_PCAP) + # dumpcap will most likely be installed with + # capabilities or setuid. Relative RPATHs that + # resolve to non-standard library directories + # are ignored for such binaries and since we + # cannot achieve relocatable builds, just + # disable it by default. + set(_enable_rpath_origin FALSE) + endif() + # Provide a knob to optionally force absolute rpaths, + # to support old/buggy systems and as a user preference + # for hardening. + set(ENABLE_RPATH_ORIGIN ${_enable_rpath_origin} CACHE BOOL + "Use $ORIGIN with INSTALL_RPATH") + mark_as_advanced(ENABLE_RPATH_ORIGIN) else() - set(_enable_rpath_origin FALSE) + set(ENABLE_RPATH_ORIGIN FALSE) endif() - - # Provide a knob to optionally force absolute rpaths, - # to support old/buggy systems and as a user preference - # for hardening. - # XXX Should this be a CMake option? - set(ENABLE_RPATH_ORIGIN ${_enable_rpath_origin} CACHE BOOL - "Use $ORIGIN with INSTALL_RPATH") - mark_as_advanced(ENABLE_RPATH_ORIGIN) - if(ENABLE_RPATH_ORIGIN) set(LIBRARY_INSTALL_RPATH "$ORIGIN") set(EXECUTABLE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") @@ -3119,47 +3120,28 @@ endif() if(BUILD_dumpcap AND PCAP_FOUND) set(dumpcap_LIBS writecap - wsutil_static + wsutil + caputils + iface_monitor pcap::pcap ${CAP_LIBRARIES} ${ZLIB_LIBRARIES} - ${NL_LIBRARIES} ${APPLE_CORE_FOUNDATION_LIBRARY} ${APPLE_SYSTEM_CONFIGURATION_LIBRARY} ${WIN_WS2_32_LIBRARY} ) - if(UNIX) - list(APPEND CAPUTILS_SRC - capture/capture-pcap-util-unix.c) - endif() - if(WIN32) - list(APPEND CAPUTILS_SRC - capture/capture_win_ifnames.c - capture/capture-wpcap.c - ) - endif() - list(APPEND CAPUTILS_SRC - capture/capture-pcap-util.c - ) - if (AIRPCAP_FOUND) - list(APPEND CAPUTILS_SRC capture/airpcap_loader.c) - endif() set(dumpcap_FILES - capture_opts.c - cli_main.c + $<TARGET_OBJECTS:capture_opts> + $<TARGET_OBJECTS:cli_main> dumpcap.c ringbuffer.c sync_pipe_write.c - capture/iface_monitor.c - capture/ws80211_utils.c - ${CAPUTILS_SRC} ) set_executable_resources(dumpcap "Dumpcap" UNIQUE_RC) add_executable(dumpcap ${dumpcap_FILES}) set_extra_executable_properties(dumpcap "Executables") target_link_libraries(dumpcap ${dumpcap_LIBS}) - target_include_directories(dumpcap SYSTEM PRIVATE ${ZLIB_INCLUDE_DIRS} ${NL_INCLUDE_DIRS}) - target_compile_definitions(dumpcap PRIVATE ENABLE_STATIC) + target_include_directories(dumpcap SYSTEM PRIVATE ${ZLIB_INCLUDE_DIRS}) executable_link_mingw_unicode(dumpcap) install(TARGETS dumpcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |