aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorFabrice Fontaine <fontaine.fabrice@gmail.com>2019-04-22 18:39:52 +0200
committerPeter Wu <peter@lekensteyn.nl>2019-04-23 23:19:40 +0000
commit900b9f137910c0ad0fe95d7354af8315ffeb0b04 (patch)
tree5c08e28a7f35db6ed8200d1cd5006ea568acc892 /CMakeLists.txt
parentdd1245f5be20e10f8ef917b20c302129b505cd97 (diff)
CMake: add USE_STATIC option
USE_STATIC will: - always link statically with external libraries (such as glib2) - will not set rpath to avoid the following error: CMake Error at cmake_install.cmake:50 (file): file RPATH_CHANGE could not write new RPATH: /usr/lib to the file: /home/fabrice/br-test-pkg/br-arm-full-static/target/usr/bin/tshark No valid ELF RPATH or RUNPATH entry exists in the file; Change-Id: I242dc1a091cc211ee891568a2dee5080c9974fba Ping-Bug: 15713 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Reviewed-on: https://code.wireshark.org/review/32945 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt6
1 files changed, 5 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index df62819651..e2fdafc227 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -185,7 +185,7 @@ set(PROJECT_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}")
set(LIBRARY_INSTALL_RPATH "")
set(EXECUTABLE_INSTALL_RPATH "")
set(EXTCAP_INSTALL_RPATH "")
-if(NOT (WIN32 OR APPLE))
+if(NOT (WIN32 OR APPLE OR USE_STATIC))
# Try to set a RPATH for installed binaries if the library directory is
# not already included in the default search list.
list(FIND CMAKE_C_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_FULL_LIBDIR}" IS_SYSTEM_DIR)
@@ -325,6 +325,10 @@ if(OSS_FUZZ)
message(FATAL_ERROR "Cannot force libFuzzer when using oss-fuzz")
endif()
# Must not depend on external dependencies so statically link all libs.
+ set(USE_STATIC ON)
+endif()
+
+if(USE_STATIC)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
endif()