Fix build with non-standard install prefix

The variables BUILD_dumpcap and PCAP_FOUND are defined after the if
condition, therefore wireshark is built with a relative RPATH and
library loading for privileged processes fails with glibc.

Move the definition of BUILD_dumpcap before it is used and drop
the test for PCAP_FOUND.

Move a comment to the proper line while at it.

Change-Id: Ie151a3781898e712f9e324e9ef995022bbea40b6
Reviewed-on: https://code.wireshark.org/review/34564
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
João Valverde 2019-09-17 19:07:54 +01:00 committed by Guy Harris
parent a97c157d0d
commit a544570546
1 changed files with 6 additions and 5 deletions

View File

@ -41,6 +41,8 @@ set(PROJECT_VERSION "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
include( CMakeOptions.txt )
# We require minimum C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -199,11 +201,8 @@ if(NOT (WIN32 OR APPLE OR USE_STATIC))
# binaries. In other cases, only absolute paths can be used.
# https://www.lekensteyn.nl/rpath.html
if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|SunOS|FreeBSD)$")
# Provide a knob to optionally force absolute rpaths,
# to support old/buggy systems and as a user preference
# for hardening.
set(_enable_rpath_origin TRUE)
if(BUILD_dumpcap AND PCAP_FOUND)
if(BUILD_dumpcap)
# dumpcap will most likely be installed with
# capabilities or setuid. Relative RPATHs that
# resolve to non-standard library directories
@ -212,6 +211,9 @@ if(NOT (WIN32 OR APPLE OR USE_STATIC))
# 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)
@ -310,7 +312,6 @@ include_directories(
${CMAKE_SOURCE_DIR}
)
include( CMakeOptions.txt )
if( DUMPCAP_INSTALL_OPTION STREQUAL "suid" )
set( DUMPCAP_SETUID "SETUID" )
else()