summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcostan <costan@google.com>2017-08-16 18:46:27 -0700
committerVictor Costan <pwnall@chromium.org>2017-08-16 19:19:31 -0700
commit55924d11095df25ab25c405fadfe93d0a46f82eb (patch)
treea22dfcafb7ea5a5e5948fa3fe2b0beffae4c4092
parent632cd0f12856ef7e1feda46021940a98d7117bda (diff)
downloadsnappy-55924d11095df25ab25c405fadfe93d0a46f82eb.tar.gz
snappy-55924d11095df25ab25c405fadfe93d0a46f82eb.tar.bz2
snappy-55924d11095df25ab25c405fadfe93d0a46f82eb.zip
Add GNUInstallDirs to CMake configuration.
This is modeled after https://github.com/google/googletest/pull/1160. The immediate benefit is fixing the library install paths on 64-bit Linux distributions, which tend to support running 32-bit and 64-bit code side by side by installing 32-bit libraries in /usr/lib and 64-bit libraries in /usr/lib64.
-rw-r--r--CMakeLists.txt18
1 files changed, 14 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a90a08..035f862 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -140,14 +140,20 @@ if(SNAPPY_BUILD_TESTS)
COMMAND "${PROJECT_BINARY_DIR}/snappy_unittest")
endif(SNAPPY_BUILD_TESTS)
-install(TARGETS snappy EXPORT SnappyTargets DESTINATION lib)
+include(GNUInstallDirs)
+install(TARGETS snappy
+ EXPORT SnappyTargets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
install(
FILES
"${PROJECT_SOURCE_DIR}/snappy-c.h"
"${PROJECT_SOURCE_DIR}/snappy-sinksource.h"
"${PROJECT_SOURCE_DIR}/snappy.h"
"${PROJECT_BINARY_DIR}/snappy-stubs-public.h"
- DESTINATION include
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
include(CMakePackageConfigHelpers)
@@ -155,10 +161,14 @@ write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/SnappyConfigVersion.cmake"
COMPATIBILITY SameMajorVersion
)
-install(EXPORT SnappyTargets NAMESPACE Snappy:: DESTINATION lib/cmake/Snappy)
+install(
+ EXPORT SnappyTargets
+ NAMESPACE Snappy::
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Snappy"
+)
install(
FILES
"${PROJECT_SOURCE_DIR}/cmake/SnappyConfig.cmake"
"${PROJECT_BINARY_DIR}/SnappyConfigVersion.cmake"
- DESTINATION lib/cmake/Snappy
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Snappy"
)