0002-cmake-disable-shared-library-build-when-BUILD_SHARED.patch
1.54 KB
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
From b3cddf92adacfe5ca40574afb3e323cc7cdebc5c Mon Sep 17 00:00:00 2001
From: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Date: Tue, 2 Feb 2016 15:46:09 +0100
Subject: [PATCH] cmake: Add shared library conditonnal build
When BUILD_SHARED_LIBS is off, you don't want to build the shared
library.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
src/CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 99cf9e9..9e9c77d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -37,6 +37,7 @@ SET(LIBRARY_OUTPUT_PATH ${libDir})
ADD_LIBRARY(yajl_s STATIC ${SRCS} ${HDRS} ${PUB_HDRS})
+IF(BUILD_SHARED_LIBS)
ADD_LIBRARY(yajl SHARED ${SRCS} ${HDRS} ${PUB_HDRS})
#### setup shared library version number
@@ -51,6 +52,7 @@ IF(APPLE)
SET_TARGET_PROPERTIES(yajl PROPERTIES
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF(APPLE)
+ENDIF(BUILD_SHARED_LIBS)
#### build up an sdk as a post build step
@@ -77,10 +79,12 @@ INCLUDE_DIRECTORIES(${incDir}/..)
# at build time you may specify the cmake variable LIB_SUFFIX to handle
# 64-bit systems which use 'lib64'
+IF(BUILD_SHARED_LIBS)
INSTALL(TARGETS yajl
RUNTIME DESTINATION lib${LIB_SUFFIX}
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX})
+ENDIF(BUILD_SHARED_LIBS)
INSTALL(TARGETS yajl_s ARCHIVE DESTINATION lib${LIB_SUFFIX})
INSTALL(FILES ${PUB_HDRS} DESTINATION include/yajl)
INSTALL(FILES ${incDir}/yajl_version.h DESTINATION include/yajl)
--
2.7.0