2014-10-31 14:49:02 +01:00
|
|
|
From 045b035bd9ebbd45f40dda36b143ede869eb5f16 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Sagaert Johan <sagaert.johan@skynet.be>
|
|
|
|
Date: Fri, 31 Oct 2014 12:25:48 +0100
|
2014-08-30 11:52:24 +02:00
|
|
|
Subject: [PATCH 2/2] cmake: disable shared library build when
|
|
|
|
BUILD_SHARED_LIBS is off
|
|
|
|
|
2014-10-31 14:49:02 +01:00
|
|
|
Original patch from Samuel Martin, reworked by Sagaert Johan when
|
|
|
|
updating libwebsockets.
|
|
|
|
|
2014-08-30 11:52:24 +02:00
|
|
|
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
|
2014-10-31 14:49:02 +01:00
|
|
|
Signed-off-by: Sagaert Johan <sagaert.johan@skynet.be>
|
2014-08-30 11:52:24 +02:00
|
|
|
---
|
2014-10-31 14:49:02 +01:00
|
|
|
CMakeLists.txt | 17 ++++++++++++-----
|
|
|
|
1 file changed, 12 insertions(+), 5 deletions(-)
|
2014-08-30 11:52:24 +02:00
|
|
|
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
2014-10-31 14:49:02 +01:00
|
|
|
index 7978845..89853ce 100644
|
2014-08-30 11:52:24 +02:00
|
|
|
--- a/CMakeLists.txt
|
|
|
|
+++ b/CMakeLists.txt
|
2014-10-31 14:49:02 +01:00
|
|
|
@@ -372,14 +372,19 @@ source_group("Sources" FILES ${SOURCES})
|
2014-08-30 11:52:24 +02:00
|
|
|
#
|
|
|
|
# Create the lib.
|
|
|
|
#
|
|
|
|
+set(_libs_websockets websockets)
|
|
|
|
add_library(websockets STATIC
|
|
|
|
${HDR_PRIVATE}
|
|
|
|
${HDR_PUBLIC}
|
|
|
|
${SOURCES})
|
|
|
|
+
|
|
|
|
+if(BUILD_SHARED_LIBS)
|
|
|
|
+list(APPEND _libs_websockets websockets_shared)
|
|
|
|
add_library(websockets_shared SHARED
|
|
|
|
${HDR_PRIVATE}
|
|
|
|
${HDR_PUBLIC}
|
|
|
|
${SOURCES})
|
|
|
|
+endif()
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
# On Windows libs have the same file ending (.lib)
|
2014-10-31 14:49:02 +01:00
|
|
|
@@ -400,15 +405,17 @@ endif(WIN32)
|
2014-08-30 11:52:24 +02:00
|
|
|
|
|
|
|
# We want the shared lib to be named "libwebsockets"
|
|
|
|
# not "libwebsocket_shared".
|
|
|
|
+if(BUILD_SHARED_LIBS)
|
|
|
|
set_target_properties(websockets_shared
|
|
|
|
- PROPERTIES
|
|
|
|
+ PROPERTIES
|
|
|
|
OUTPUT_NAME websockets)
|
|
|
|
+endif()
|
|
|
|
|
|
|
|
# Set the so version of the lib.
|
|
|
|
# Equivalent to LDFLAGS=-version-info x:x:x
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
- foreach(lib websockets websockets_shared)
|
|
|
|
- set_target_properties(${lib}
|
|
|
|
+ foreach(lib ${_libs_websockets})
|
|
|
|
+ set_target_properties(${lib}
|
|
|
|
PROPERTIES
|
|
|
|
SOVERSION ${SOVERSION})
|
|
|
|
endforeach()
|
2014-10-31 14:49:02 +01:00
|
|
|
@@ -460,7 +467,7 @@ if (NOT LWS_WITHOUT_EXTENSIONS)
|
2014-08-30 11:52:24 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Make sure ZLib is compiled before the libs.
|
|
|
|
- foreach (lib websockets websockets_shared)
|
|
|
|
+ foreach (lib ${_libs_websockets})
|
|
|
|
add_dependencies(${lib} ZLIB)
|
|
|
|
endforeach()
|
|
|
|
|
2014-10-31 14:49:02 +01:00
|
|
|
@@ -524,7 +531,7 @@ if (UNIX)
|
2014-08-30 11:52:24 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Setup the linking for all libs.
|
|
|
|
-foreach (lib websockets websockets_shared)
|
|
|
|
+foreach (lib ${_libs_websockets})
|
|
|
|
target_link_libraries(${lib} ${LIB_LIST})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
--
|
2014-10-31 14:49:02 +01:00
|
|
|
2.1.2
|
2014-08-30 11:52:24 +02:00
|
|
|
|