Simplify CMakeLists.txt
Change-Id: I11ee872c8bab3fc810d9f739eedbda6e263bd78a
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 322df37..9479d90 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,9 +4,16 @@
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
include(GNUInstallDirs)
+
+# the RPATH to be used when installing, but only if it's not a system directory
+list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+if("${isSystemDir}" STREQUAL "-1")
+ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+endif("${isSystemDir}" STREQUAL "-1")
+
include_directories(/usr/local/include;/usr/local/kl/include)
-link_directories(/usr/local/lib;/usr/local/kl/lib)
-find_library(ROCKSDB NAMES librocksdb.so.5.11 librocksdb.so.5.10 librocksdb.so.5)
+link_directories(/usr/local/kl/lib /usr/local/lib)
+find_library(ROCKSDB NAMES librocksdb.so.5.11)
find_library(ROCKSDB_STATIC librocksdb.a)
enable_testing()
@@ -28,13 +35,7 @@
TARGET_LINK_LIBRARIES(static_library_test collocatordb_static)
add_test(STATIC_LIBRARY_TEST static_library_test)
-configure_file(collocatordb.pc.in collocatordb.pc @ONLY)
-target_include_directories(collocatordb PRIVATE .)
-install(TARGETS collocatordb collocatordb_static
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
-install(FILES ${CMAKE_BINARY_DIR}/collocatordb.pc
- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
-
# Install library
-install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME})
+install(TARGETS ${PROJECT_NAME}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})