summaryrefslogtreecommitdiffstats
path: root/src/libwebsockets-1-fixes.patch
blob: ce7beccefe383a69e133bcfa10390fa099c88f50 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
This file is part of MXE. See LICENSE.md for licensing information.

From e34eaa834b15533c6280b67d93d505432bd2fa94 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Mon, 4 Aug 2014 18:28:33 -0700
Subject: [PATCH] Remove the special _shared lib

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ff9a24e..962df28 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -372,43 +372,41 @@ source_group("Sources"          FILES ${SOURCES})
 #
 # Create the lib.
 #
-add_library(websockets STATIC
-			${HDR_PRIVATE}
-			${HDR_PUBLIC}
-			${SOURCES})
-add_library(websockets_shared SHARED
+add_library(websockets
 			${HDR_PRIVATE}
 			${HDR_PUBLIC}
 			${SOURCES})
 
 if (WIN32)
-	# On Windows libs have the same file ending (.lib)
-	# for both static and shared libraries, so we
-	# need a unique name for the static one.
-	set_target_properties(websockets 
-		PROPERTIES
-		OUTPUT_NAME websockets_static)
-
-	# Compile as DLL (export function declarations)
-	set_property(
-		TARGET websockets_shared
-		PROPERTY COMPILE_DEFINITIONS 
-		LWS_DLL
-		LWS_INTERNAL
-		)
+# 	# On Windows libs have the same file ending (.lib)
+# 	# for both static and shared libraries, so we
+# 	# need a unique name for the static one.
+# 	set_target_properties(websockets
+# 		PROPERTIES
+# 		OUTPUT_NAME websockets_static)
+
+	if (BUILD_SHARED_LIBS)
+		# Compile as DLL (export function declarations)
+		set_property(
+			TARGET websockets
+			PROPERTY COMPILE_DEFINITIONS
+			LWS_DLL
+			LWS_INTERNAL
+			)
+	endif (BUILD_SHARED_LIBS)
 endif(WIN32)
 
 # We want the shared lib to be named "libwebsockets"
 # not "libwebsocket_shared".
-set_target_properties(websockets_shared
-		PROPERTIES 
-		OUTPUT_NAME websockets)
+# set_target_properties(websockets_shared
+# 		PROPERTIES
+# 		OUTPUT_NAME websockets)
 
 # 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 websockets)
+		set_target_properties(${lib}
 			PROPERTIES
 			SOVERSION ${SOVERSION})
 	endforeach()
@@ -460,7 +458,7 @@ if (NOT LWS_WITHOUT_EXTENSIONS)
 	endif()
 
 	# Make sure ZLib is compiled before the libs.
-	foreach (lib websockets websockets_shared)
+	foreach (lib websockets)
 		add_dependencies(${lib} ZLIB)
 	endforeach()
 
@@ -524,7 +522,7 @@ if (UNIX)
 endif()
 
 # Setup the linking for all libs.
-foreach (lib websockets websockets_shared)
+foreach (lib websockets)
 	target_link_libraries(${lib} ${LIB_LIST})
 endforeach()
 
@@ -557,11 +555,8 @@ if (NOT LWS_WITHOUT_TESTAPPS)
 		source_group("Headers Private"   FILES ${TEST_HDR})
 		source_group("Sources"   FILES ${TEST_SRCS})
 		add_executable(${TEST_NAME} ${TEST_SRCS} ${TEST_HDR})
-		
-		if (LWS_LINK_TESTAPPS_DYNAMIC)
-			target_link_libraries(${TEST_NAME} websockets_shared)
-			add_dependencies(${TEST_NAME} websockets_shared)
-		else(LWS_LINK_TESTAPPS_DYNAMIC)
+
+		if (NOT LWS_LINK_TESTAPPS_DYNAMIC)
 			target_link_libraries(${TEST_NAME} websockets)
 			add_dependencies(${TEST_NAME} websockets)
 		endif(LWS_LINK_TESTAPPS_DYNAMIC)
@@ -793,7 +788,7 @@ endif()
 set(LWS_INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
 
 # Export targets (This is used for other CMake projects to easily find the libraries and include files).
-export(TARGETS websockets websockets_shared
+export(TARGETS websockets
         FILE "${PROJECT_BINARY_DIR}/LibwebsocketsTargets.cmake")
 export(PACKAGE libwebsockets)
 
@@ -829,7 +824,7 @@ configure_file(${PROJECT_SOURCE_DIR}/cmake/LibwebsocketsConfigVersion.cmake.in
                 ${PROJECT_BINARY_DIR}/LibwebsocketsConfigVersion.cmake 
                 @ONLY)
 
-set_target_properties(websockets websockets_shared 
+set_target_properties(websockets
 					PROPERTIES PUBLIC_HEADER "${HDR_PUBLIC}")
 
 #
@@ -837,7 +832,7 @@ set_target_properties(websockets websockets_shared
 #
 
 # Install libs and headers.
-install(TARGETS websockets websockets_shared
+install(TARGETS websockets
 		EXPORT LibwebsocketsTargets
 		LIBRARY DESTINATION "${LWS_INSTALL_LIB_DIR}${LIB_SUFFIX}" COMPONENT libraries
 		ARCHIVE DESTINATION "${LWS_INSTALL_LIB_DIR}${LIB_SUFFIX}" COMPONENT libraries
@@ -906,9 +901,8 @@ message(" LWS_WITH_HTTP2 = ${LWS_WITH_HTTP2}")
 message("---------------------------------------------------------------------")
 
 # These will be available to parent projects including libwebsockets using add_subdirectory()
-set(LIBWEBSOCKETS_LIBRARIES websocket websockets_shared CACHE STRING "Libwebsocket libraries")
+set(LIBWEBSOCKETS_LIBRARIES websocket CACHE STRING "Libwebsocket libraries")
 set(LIBWEBSOCKETS_LIBRARIES_STATIC websocket CACHE STRING "Libwebsocket static library")
-set(LIBWEBSOCKETS_LIBRARIES_SHARED websockets_shared CACHE STRING "Libwebsocket shared library")
 
 # This must always be last!
 include(CPack)
diff --git a/cmake/LibwebsocketsConfig.cmake.in b/cmake/LibwebsocketsConfig.cmake.in
index bea82b5..6973fbf 100644
--- a/cmake/LibwebsocketsConfig.cmake.in
+++ b/cmake/LibwebsocketsConfig.cmake.in
@@ -13,5 +13,5 @@ set(LIBWEBSOCKETS_INCLUDE_DIRS "@LWS__INCLUDE_DIRS@")
 include(${LWS_CMAKE_DIR}/LibwebsocketsTargets.cmake)
 
 # IMPORTED targets from LibwebsocketsTargets.cmake
-set(LIBWEBSOCKETS_LIBRARIES websockets websockets_shared)
+set(LIBWEBSOCKETS_LIBRARIES websockets)
 
-- 
1.9.1