summaryrefslogtreecommitdiffstats
path: root/HdrHistogram_c-static.patch
blob: de85b3743e3af097f4282cb7486b7bc93d9acd94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From d74a6abee509010a17c4a2c18e9d29acd3bad5d4 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 15 Jun 2020 10:50:12 +0200
Subject: [PATCH] add options to be able to not install libraries

---
 src/CMakeLists.txt | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a30f8fc..60be048 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,7 +28,7 @@ set(HDR_HISTOGRAM_PUBLIC_HEADERS
     hdr_time.h
     hdr_writer_reader_phaser.h)
 
-function(hdr_histogram_add_library NAME LIBRARY_TYPE)
+function(hdr_histogram_add_library NAME LIBRARY_TYPE DO_INSTALL)
     add_library(${NAME} ${LIBRARY_TYPE}
         ${HDR_HISTOGRAM_SOURCES}
         ${HDR_HISTOGRAM_PRIVATE_HEADERS}
@@ -44,23 +44,27 @@ function(hdr_histogram_add_library NAME LIBRARY_TYPE)
         PUBLIC
             $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
             $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
-    install(
-        TARGETS ${NAME}
-        EXPORT ${PROJECT_NAME}-targets
-        DESTINATION ${CMAKE_INSTALL_LIBDIR})
+    if(DO_INSTALL)
+        install(
+            TARGETS ${NAME}
+            EXPORT ${PROJECT_NAME}-targets
+            DESTINATION ${CMAKE_INSTALL_LIBDIR})
+    endif()
 endfunction()
 
 option(HDR_HISTOGRAM_BUILD_SHARED "Build shared library" ON)
+option(HDR_HISTOGRAM_BUILD_SHARED "Install shared library" ON)
 if(HDR_HISTOGRAM_BUILD_SHARED)
-    hdr_histogram_add_library(hdr_histogram SHARED)
+    hdr_histogram_add_library(hdr_histogram SHARED ${HDR_HISTOGRAM_BUILD_SHARED})
     set_target_properties(hdr_histogram PROPERTIES
         VERSION ${HDR_VERSION}
         SOVERSION ${HDR_SOVERSION})
 endif()
 
 option(HDR_HISTOGRAM_BUILD_STATIC "Build static library" ON)
+option(HDR_HISTOGRAM_INSTALL_STATIC "Install static library" ON)
 if(HDR_HISTOGRAM_BUILD_STATIC)
-    hdr_histogram_add_library(hdr_histogram_static STATIC)
+    hdr_histogram_add_library(hdr_histogram_static STATIC ${HDR_HISTOGRAM_INSTALL_STATIC})
 endif()
 
 install(