summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean@guyomarch.bzh>2018-01-27 12:09:21 +0100
committerJean Guyomarc'h <jean@guyomarch.bzh>2018-01-27 12:09:21 +0100
commit08ccc91d6061d6ad6d5b4a9390809ced62da993a (patch)
tree72e324dd97addbacd039c1a58183559670b51ed5
parent9f9db6ce87b8ef5ad988912193820df7ba733a28 (diff)
cmake: don't force the installation of libs in $prefix/lib
The installation libdir is now by default either lib32, lib64 (or lib as a fallback) instead of always being lib. Passing -DLIB_INSTALL_DIR=path/ to cmake allows builders to override the libdir. Ref #28
-rw-r--r--CMakeLists.txt6
-rw-r--r--README.md9
-rw-r--r--cmake/Modules/plugin.cmake2
-rw-r--r--plugins/CMakeLists.txt2
4 files changed, 17 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb4e285..78cf366 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,12 @@ else ()
23 set(LIB_SUFFIX "") 23 set(LIB_SUFFIX "")
24endif () 24endif ()
25 25
26# Set the directory where libraries will be installed (e.g. /usr/lib64, ...)
27# This is overridable by users via -DLIb_INSTALL_DIR=alternate-lib-dir
28set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}"
29 CACHE STRING
30 "Set the installation prefix of libraries (relative the prefix installation)")
31
26# Shared objects (loadable modules) have different extensions from one platform 32# Shared objects (loadable modules) have different extensions from one platform
27# to another. OSX and Linux use .so, whereas Windows uses .dll. There may be 33# to another. OSX and Linux use .so, whereas Windows uses .dll. There may be
28# more, that I'm not aware of. 34# more, that I'm not aware of.
diff --git a/README.md b/README.md
index bb0cdd0..c95bb7f 100644
--- a/README.md
+++ b/README.md
@@ -60,11 +60,20 @@ mkdir -p build && cd build
60cmake -DCMAKE_BUILD_TYPE=Release .. 60cmake -DCMAKE_BUILD_TYPE=Release ..
61cmake --build . 61cmake --build .
62cmake --build . --target install # Possibly as root (i.e. via sudo) 62cmake --build . --target install # Possibly as root (i.e. via sudo)
63ldconfig # On Linux only, possibly as root (i.e. via sudo)
63``` 64```
64 65
65If we want to run `eovim` without installing it, please refer to the 66If we want to run `eovim` without installing it, please refer to the
66**Hacking** section. 67**Hacking** section.
67 68
69Note that unless `-DWITH_OPTIONS=OFF` is passed to cmake, eovim will install
70libraries. Hence, the need to run `ldconfig` after installing Eovim. Libraries
71are by default installed in the **prefix** directory passed to cmake (by default
72`/usr/local`) in a subdirectory that can be either `lib32/`, `lib64/` or `lib/`
73dependending on how the target architecture is detected. This subdirectory can
74be forced by passing `-DLIB_INSTALL_DIR=alteratnate-lib-dir` to cmake.
75
76
68# Usage 77# Usage
69 78
70```bash 79```bash
diff --git a/cmake/Modules/plugin.cmake b/cmake/Modules/plugin.cmake
index 909c4a1..ba33d85 100644
--- a/cmake/Modules/plugin.cmake
+++ b/cmake/Modules/plugin.cmake
@@ -24,5 +24,5 @@ function (add_plugin Plugin)
24 add_nazi_compiler_warnings(${Plugin}) 24 add_nazi_compiler_warnings(${Plugin})
25 set_target_properties(${Plugin} PROPERTIES PREFIX "") 25 set_target_properties(${Plugin} PROPERTIES PREFIX "")
26 26
27 install(TARGETS ${Plugin} LIBRARY DESTINATION lib/eovim) 27 install(TARGETS ${Plugin} LIBRARY DESTINATION ${LIB_INSTALL_DIR}/eovim)
28endfunction () 28endfunction ()
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index e3b8ec1..fb5610a 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -18,7 +18,7 @@ set_target_properties(libeovim PROPERTIES
18 # Place libeovim in another directory than plugins/, as in tree execution 18 # Place libeovim in another directory than plugins/, as in tree execution
19 # will consider libeovim as a plugin, due to its .so extension on Linux 19 # will consider libeovim as a plugin, due to its .so extension on Linux
20 LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") 20 LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
21install(TARGETS libeovim LIBRARY DESTINATION lib) 21install(TARGETS libeovim LIBRARY DESTINATION ${LIB_INSTALL_DIR})
22 22
23############################################################################## 23##############################################################################
24# Built-in plugins 24# Built-in plugins