From: Andres Noetzli Date: Wed, 24 Oct 2018 04:43:28 +0000 (-0700) Subject: CMake: Set RPATH on installed binary (#2671) X-Git-Tag: cvc5-1.0.0~4387 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3741bb7103c06a70dbcb1edd3af3371bd41285a2;p=cvc5.git 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. --- 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)