77 lines
2.6 KiB
Diff
77 lines
2.6 KiB
Diff
|
From 2e9a2e1d71bf10312d03470b56006a03ca2b06f7 Mon Sep 17 00:00:00 2001
|
||
|
From: Michal Rostecki <mrostecki@suse.de>
|
||
|
Date: Tue, 11 Dec 2018 18:25:16 +0100
|
||
|
Subject: [PATCH 2/2] cmake: Use GNUInstallDirs for libdir and includedir
|
||
|
|
||
|
The comon practice in cmake to allow to specify the libdir or
|
||
|
includedir using GNUInstallDirs which introduces the following
|
||
|
options:
|
||
|
|
||
|
* CMAKE_INSTALL_INCLUDEDIR
|
||
|
* CMAKE_INSTALL_LIBDIR
|
||
|
|
||
|
The main motivation behind this change is ability to use /usr/lib64
|
||
|
instead of /usr/lib as a libdir.
|
||
|
|
||
|
Signed-off-by: Michal Rostecki <mrostecki@suse.de>
|
||
|
---
|
||
|
CMakeLists.txt | 14 ++++++++++----
|
||
|
1 file changed, 10 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 29b427e..4b51430 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -28,6 +28,12 @@ include(CPack)
|
||
|
# ==============================================================================
|
||
|
# Set up options
|
||
|
|
||
|
+# Introduce variables:
|
||
|
+# * CMAKE_INSTALL_LIBDIR
|
||
|
+# * CMAKE_INSTALL_BINDIR
|
||
|
+# * CMAKE_INSTALL_INCLUDEDIR
|
||
|
+include(GNUInstallDirs)
|
||
|
+
|
||
|
option(WITH_GRPC "Build with support for gRPC." ON)
|
||
|
option(WITH_DYNAMIC_LOAD "Build support for dynamic loading." ON)
|
||
|
option(ENABLE_LINTING "Run clang-tidy on sources if available." OFF)
|
||
|
@@ -67,7 +73,7 @@ configure_file(version.h.in include/lightstep/version.h)
|
||
|
configure_file(config.h.in include/lightstep/config.h)
|
||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
||
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/lightstep
|
||
|
- DESTINATION include)
|
||
|
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||
|
|
||
|
if(HEADERS_ONLY)
|
||
|
return()
|
||
|
@@ -152,7 +158,7 @@ add_subdirectory(3rd_party)
|
||
|
include_directories(SYSTEM ${LIGHTSTEP_THIRD_PARTY_INCLUDES})
|
||
|
|
||
|
include_directories(include)
|
||
|
-install(DIRECTORY include/lightstep DESTINATION include)
|
||
|
+install(DIRECTORY include/lightstep DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||
|
|
||
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
|
||
|
include(LightStepTracerCommon)
|
||
|
@@ -206,7 +212,7 @@ if (BUILD_SHARED_LIBS)
|
||
|
target_link_libraries(lightstep_tracer ${LIGHTSTEP_LINK_LIBRARIES})
|
||
|
set_target_properties(lightstep_tracer PROPERTIES SOVERSION ${LIGHTSTEP_VERSION_MAJOR})
|
||
|
install(TARGETS lightstep_tracer
|
||
|
- LIBRARY DESTINATION lib)
|
||
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||
|
endif()
|
||
|
|
||
|
if (BUILD_STATIC_LIBS)
|
||
|
@@ -222,7 +228,7 @@ if (BUILD_STATIC_LIBS)
|
||
|
endif()
|
||
|
target_link_libraries(lightstep_tracer-static ${LIGHTSTEP_LINK_LIBRARIES})
|
||
|
install(TARGETS lightstep_tracer-static
|
||
|
- ARCHIVE DESTINATION lib)
|
||
|
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||
|
endif()
|
||
|
|
||
|
|
||
|
--
|
||
|
2.19.2
|
||
|
|