summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2018-10-23 21:43:28 -0700
committerGitHub <noreply@github.com>2018-10-23 21:43:28 -0700
commit3741bb7103c06a70dbcb1edd3af3371bd41285a2 (patch)
tree6f0a0fde9ff30c3e60704aaf3a8a6c01ac153661
parentc5982fa8fa60f25b01efcf45cf73bca353226d84 (diff)
CMake: Set RPATH on installed binary (#2671)
Currently, when installing CVC4 with a custom installation directory on macOS, the resulting binary cannot be executed because the linker cannot find the required libraries (e.g. our parser). This commit changes our build system to use the `CMAKE_INSTALL_RPATH` variable to add the installation directory to the RPATH list in the exectuable.
-rw-r--r--CMakeLists.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a35d75dc9..33824d186 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,6 +31,17 @@ set(CMAKE_CXX_STANDARD 11)
# plugins.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+# Embed the installation prefix as an RPATH in the executable such that the
+# linker can find our libraries (such as libcvc4parser) when executing the cvc4
+# binary. This is for example useful when installing CVC4 with a custom prefix
+# on macOS (e.g. when using homebrew in a non-standard directory). If we do not
+# set this option, then the linker will not be able to find the required
+# libraries when trying to run CVC4.
+#
+# More information on RPATH in CMake:
+# https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
+set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+
#-----------------------------------------------------------------------------#
include(Helpers)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback