summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorVictor Costan <costan@google.com>2019-11-04 11:38:53 -0800
committerVictor Costan <pwnall@chromium.org>2019-11-05 00:32:51 -0800
commit5abdf4c019e51fce59d34c21b13bf4e0a948828a (patch)
tree0b86ee1c6a9ff46272bef4847bceeba189f69366 /CMakeLists.txt
parentcf4d9ab23de7ec36b8e00536b7450f02c639cd87 (diff)
downloadleveldb-5abdf4c019e51fce59d34c21b13bf4e0a948828a.tar.gz
Fix installed target definition.
Using CMAKE_INSTALL_INCLUDEDIR before including GNUINstallDirs results in a broken installation when CMAKE_INSTALL_PREFIX is a non-standard directory. Inspired from https://github.com/google/crc32c/pull/39 PiperOrigin-RevId: 278427974
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt4
1 files changed, 3 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a65afbf..7ccda94 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,6 +106,9 @@ if(BUILD_SHARED_LIBS)
add_compile_options(-fvisibility=hidden)
endif(BUILD_SHARED_LIBS)
+# Must be included before CMAKE_INSTALL_INCLUDEDIR is used.
+include(GNUInstallDirs)
+
add_library(leveldb "")
target_sources(leveldb
PRIVATE
@@ -417,7 +420,6 @@ int main() {
endif(LEVELDB_BUILD_BENCHMARKS)
if(LEVELDB_INSTALL)
- include(GNUInstallDirs)
install(TARGETS leveldb
EXPORT leveldbTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}