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