summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2020-06-11 20:05:39 -0700
committerGitHub <noreply@github.com>2020-06-11 22:05:39 -0500
commitd7847d052eb45695f24b2d534d3b6fb1551302ea (patch)
tree21bd19f3cbfc158ef0fbadd94d59f60bbcd655fd /CMakeLists.txt
parent4d547e52d3f2b54a0af7270d2b653d2cb24edb57 (diff)
Fix install of static builds (#4604)
We use CMAKE_INSTALL_PATH to set the installation prefix as an RPATH in the executable. However, for static builds, changing the RPATH fails. This commit changes our build system to only change the CMAKE_INSTALL_PATH if we are doing a shared library build.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt24
1 files changed, 11 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 000d0e50b..66872f61e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,19 +88,6 @@ set(RUNTIME_INSTALL_DIR bin)
#-----------------------------------------------------------------------------#
-# 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}/${LIBRARY_INSTALL_DIR}")
-
-#-----------------------------------------------------------------------------#
-
include(Helpers)
#-----------------------------------------------------------------------------#
@@ -306,6 +293,17 @@ if(ENABLE_SHARED)
set(ENABLE_STATIC_BINARY OFF)
message(WARNING "Disabling static binary since shared build is enabled.")
endif()
+
+ # 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}/${LIBRARY_INSTALL_DIR}")
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(BUILD_SHARED_LIBS OFF)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback