summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorFabianWolff <fabi.wolff@arcor.de>2020-09-03 03:48:36 +0200
committerGitHub <noreply@github.com>2020-09-02 18:48:36 -0700
commitedd69cb2570692f36bf26b658e967c317ebc048e (patch)
tree0ec9063e7008788ce684b93c02252490cb90688f /CMakeLists.txt
parent8b4444dad1647c89b313deedd22129252078fe1b (diff)
Drop {INCLUDE,LIBRARY,RUNTIME}_INSTALL_DIR variables in CMakeLists.txt (#4979)
On Debian (for instance), libraries aren't installed into `/usr/lib/`, but into something like `/usr/lib/x86_64-linux-gnu/`. In particular, this means that setting the `LIBRARY_INSTALL_DIR` to `lib` in the top-level `CMakeLists.txt` file is wrong. Luckily, there is a simple solution: CMake provides [`CMAKE_INSTALL_LIBDIR`](https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html) for this very purpose, which has sensible defaults and can be set by the user. In particular, since `CMAKE_INSTALL_LIBDIR` is a standardized variable, tools like the ones used for building Debian packages can set it to what they want it to be, whereas using a custom variable like `LIBRARY_INSTALL_DIR` wouldn't work in this setting. Signed-off-by: Fabian Wolff <fabi.wolff@arcor.de>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt18
1 files changed, 7 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 06e9c44f6..0a4b5aea4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.4)
project(cvc4)
+include(GNUInstallDirs)
+
set(CVC4_MAJOR 1) # Major component of the version of CVC4.
set(CVC4_MINOR 9) # Minor component of the version of CVC4.
set(CVC4_RELEASE 0) # Release component of the version of CVC4.
@@ -85,12 +87,6 @@ list(APPEND CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/deps/install")
#-----------------------------------------------------------------------------#
-set(INCLUDE_INSTALL_DIR include)
-set(LIBRARY_INSTALL_DIR lib)
-set(RUNTIME_INSTALL_DIR bin)
-
-#-----------------------------------------------------------------------------#
-
include(Helpers)
#-----------------------------------------------------------------------------#
@@ -315,7 +311,7 @@ if(ENABLE_SHARED)
#
# 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};${PROJECT_SOURCE_DIR}/deps/install/lib")
+ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR};${PROJECT_SOURCE_DIR}/deps/install/lib")
else()
# When building statically, we *only* want static archives/libraries
if (WIN32)
@@ -636,13 +632,13 @@ endif()
install(EXPORT cvc4-targets
FILE CVC4Targets.cmake
NAMESPACE CVC4::
- DESTINATION ${LIBRARY_INSTALL_DIR}/cmake/CVC4)
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CVC4)
configure_package_config_file(
${CMAKE_SOURCE_DIR}/cmake/CVC4Config.cmake.in
${CMAKE_BINARY_DIR}/cmake/CVC4Config.cmake
- INSTALL_DESTINATION ${LIBRARY_INSTALL_DIR}/cmake/CVC4
- PATH_VARS LIBRARY_INSTALL_DIR
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CVC4
+ PATH_VARS CMAKE_INSTALL_LIBDIR
)
write_basic_package_version_file(
@@ -654,7 +650,7 @@ write_basic_package_version_file(
install(FILES
${CMAKE_BINARY_DIR}/cmake/CVC4Config.cmake
${CMAKE_BINARY_DIR}/CVC4ConfigVersion.cmake
- DESTINATION ${LIBRARY_INSTALL_DIR}/cmake/CVC4
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CVC4
)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback