  	message(FATAL_ERROR "Makes no sense to compile with neither static nor shared libraries.")
  endif()
  
-@@ -590,7 +592,7 @@
- endif()
- 
- # Put the libraries and binaries that get built into directories at the
--# top of the build tree rather than in hard-to-find leaf directories. 
-+# top of the build tree rather than in hard-to-find leaf directories.
- SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
- SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
- SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
-@@ -663,7 +665,7 @@
- CHECK_INCLUDE_FILE(malloc.h LWS_HAVE_MALLOC_H)
- CHECK_INCLUDE_FILE(pthread.h LWS_HAVE_PTHREAD_H)
- 
--CHECK_LIBRARY_EXISTS(cap cap_set_flag "" LWS_HAVE_LIBCAP) 
-+CHECK_LIBRARY_EXISTS(cap cap_set_flag "" LWS_HAVE_LIBCAP)
- 
- if (LWS_WITH_LIBUV)
- CHECK_INCLUDE_FILE(uv-version.h LWS_HAVE_UV_VERSION_H)
-@@ -685,7 +687,7 @@
- 
- CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
- 
--CHECK_C_SOURCE_COMPILES("#include <stdint.h> 
-+CHECK_C_SOURCE_COMPILES("#include <stdint.h>
- 	int main(void) {
- 		intptr_t test = 1;
- 		return 0;
-@@ -801,7 +803,7 @@
- 
- if (LWS_WITH_MBEDTLS)
-  	set(LWS_WITH_SSL ON)
-- 	
-+
- 	list(APPEND HDR_PRIVATE
- 		lib/tls/mbedtls/wrapper/include/internal/ssl3.h
- 		lib/tls/mbedtls/wrapper/include/internal/ssl_cert.h
-@@ -845,7 +847,7 @@
- 	list(APPEND SOURCES
- 		lib/tls/tls.c
- 	)
--		
-+
- 		if (LWS_WITH_MBEDTLS)
- 			list(APPEND SOURCES
- 				lib/tls/mbedtls/ssl.c
-@@ -875,7 +877,7 @@
- 				)
- 			endif()
- 		endif()
--		
-+
- 	if (NOT LWS_WITHOUT_SERVER)
- 		list(APPEND SOURCES
- 			lib/tls/tls-server.c)
-@@ -897,7 +899,7 @@
- 			list(APPEND SOURCES
- 				lib/tls/openssl/openssl-client.c)
- 		endif()
--		
-+
- 	endif()
- endif()
- 
-@@ -934,10 +936,12 @@
+@@ -934,11 +936,13 @@
  	endif()
  endif()
  
 -if ((LWS_ROLE_H1 OR LWS_ROLE_H2) AND NOT LWS_WITHOUT_SERVER)
--	list(APPEND SOURCES
--		lib/roles/http/server/server.c
--		lib/roles/http/server/lws-spa.c)
 +if (LWS_ROLE_H1 OR LWS_ROLE_H2)
-+  if (NOT LWS_WITHOUT_SERVER)
-+	  list(APPEND SOURCES
-+		  lib/roles/http/server/server.c
-+		  lib/roles/http/server/lws-spa.c)
-+  endif()
++if (NOT LWS_WITHOUT_SERVER)
+ 	list(APPEND SOURCES
+ 		lib/roles/http/server/server.c
+ 		lib/roles/http/server/lws-spa.c)
  endif()
++endif()
  
  if (LWS_ROLE_WS AND NOT LWS_WITHOUT_EXTENSIONS)
-@@ -976,7 +980,7 @@
- if (LWS_WITH_LEJP)
- 	list(APPEND SOURCES
- 		lib/misc/lejp.c)
--endif()	
-+endif()
- if (LWS_WITH_LEJP_CONF)
- 		list(APPEND SOURCES
- 			"lib/roles/http/server/lejp-conf.c"
+ 	list(APPEND HDR_PRIVATE
 @@ -1038,7 +1042,7 @@
  	endif()
  endif()

 
 if (LWS_WITH_LWSWS)
 		list(APPEND LWSWS_SRCS
@@ -1967,38 +1975,39 @@
             FILE "${PROJECT_BINARY_DIR}/LibwebsocketsTargets.cmake")
 endif()
 
-export(PACKAGE libwebsockets)
+# Requires cmake >= 2.8.9 and not needed for cvmfs
+#export(PACKAGE libwebsockets)
 
 # Generate the config file for the build-tree.
-set(LWS__INCLUDE_DIRS 
+set(LWS__INCLUDE_DIRS
     "${PROJECT_SOURCE_DIR}/lib"
     "${PROJECT_BINARY_DIR}")
 set(LIBWEBSOCKETS_INCLUDE_DIRS ${LWS__INCLUDE_DIRS} CACHE PATH "Libwebsockets include directories")
 configure_file(${PROJECT_SOURCE_DIR}/cmake/LibwebsocketsConfig.cmake.in
-                ${PROJECT_BINARY_DIR}/LibwebsocketsConfig.cmake 
+                ${PROJECT_BINARY_DIR}/LibwebsocketsConfig.cmake
                 @ONLY)
 
 # Generate the config file for the installation tree.
 get_filename_component(LWS_ABSOLUTE_INSTALL_CMAKE_DIR ${LWS_INSTALL_CMAKE_DIR} ABSOLUTE)
 get_filename_component(LWS_ABSOLUTE_INSTALL_INCLUDE_DIR ${LWS_INSTALL_INCLUDE_DIR} ABSOLUTE)
-file(RELATIVE_PATH 
-    REL_INCLUDE_DIR 
+file(RELATIVE_PATH
+    REL_INCLUDE_DIR
     "${LWS_ABSOLUTE_INSTALL_CMAKE_DIR}"
     "${LWS_ABSOLUTE_INSTALL_INCLUDE_DIR}") # Calculate the relative directory from the cmake dir.
 
-# Note the EVENT_CMAKE_DIR is defined in JanssonConfig.cmake.in, 
+# Note the EVENT_CMAKE_DIR is defined in JanssonConfig.cmake.in,
 # we escape it here so it's evaluated when it is included instead
-# so that the include dirs are given relative to where the 
+# so that the include dirs are given relative to where the
 # config file is located.
-set(LWS__INCLUDE_DIRS 
-    "\${LWS_CMAKE_DIR}/${REL_INCLUDE_DIR}") 
+set(LWS__INCLUDE_DIRS
+    "\${LWS_CMAKE_DIR}/${REL_INCLUDE_DIR}")
 configure_file(${PROJECT_SOURCE_DIR}/cmake/LibwebsocketsConfig.cmake.in
-                ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/LibwebsocketsConfig.cmake 
+                ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/LibwebsocketsConfig.cmake
                 @ONLY)
 
 # Generate version info for both build-tree and install-tree.
 configure_file(${PROJECT_SOURCE_DIR}/cmake/LibwebsocketsConfigVersion.cmake.in
-                ${PROJECT_BINARY_DIR}/LibwebsocketsConfigVersion.cmake 
+                ${PROJECT_BINARY_DIR}/LibwebsocketsConfigVersion.cmake
                 @ONLY)
 
 			set_target_properties(${LWS_LIBRARIES}
@@ -2086,7 +2095,7 @@
 		      plugins/generic-sessions/assets/index.html
 		DESTINATION share/libwebsockets-test-server/generic-sessions
 			COMPONENT examples)
-	install(FILES plugins/generic-sessions/assets/successful-login.html 
+	install(FILES plugins/generic-sessions/assets/successful-login.html
 		DESTINATION share/libwebsockets-test-server/generic-sessions/needauth
 			COMPONENT examples)
 	install(FILES plugins/generic-sessions/assets/admin-login.html

--- CMakeLists.txt.orig	2019-02-16 23:43:52.372836136 +0100
+++ CMakeLists.txt	2019-02-17 10:47:44.436643882 +0100
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8.9)
+cmake_minimum_required(VERSION 2.6.2)
 
 # General Advice
 #
@@ -326,9 +326,11 @@
 endif()
 
 
-if (LWS_WITH_HTTP_PROXY AND (LWS_WITHOUT_CLIENT OR LWS_WITHOUT_SERVER))
+if (LWS_WITH_HTTP_PROXY)
+if (LWS_WITHOUT_CLIENT OR LWS_WITHOUT_SERVER)
 	message(FATAL_ERROR "You have to enable both client and server for http proxy")
 endif()
+endif()
 
 # Allow the user to override installation directories.
 set(LWS_INSTALL_LIB_DIR       lib CACHE PATH "Installation directory for libraries")
@@ -351,7 +353,7 @@
 	message(FATAL_ERROR "Makes no sense to compile with neither client nor server.")
 endif()
