IXWebSocket/CMakeLists.txt

119 lines
3.6 KiB
CMake
Raw Normal View History

2018-10-09 00:23:01 +02:00
#
# Author: Benjamin Sergeant
# Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
#
cmake_minimum_required(VERSION 3.4.1)
project(ixwebsocket C CXX)
set (CMAKE_CXX_STANDARD 14)
2018-10-09 00:23:01 +02:00
set (CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
2019-02-23 06:27:49 +01:00
# -Wshorten-64-to-32 does not work with clang
2019-01-05 02:28:13 +01:00
if (NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
endif()
2018-12-30 08:15:27 +01:00
2018-10-09 00:23:01 +02:00
set( IXWEBSOCKET_SOURCES
ixwebsocket/IXEventFd.cpp
2018-10-09 00:23:01 +02:00
ixwebsocket/IXSocket.cpp
ixwebsocket/IXSocketServer.cpp
ixwebsocket/IXSocketConnect.cpp
2018-12-15 01:28:11 +01:00
ixwebsocket/IXDNSLookup.cpp
2019-01-03 21:53:44 +01:00
ixwebsocket/IXCancellationRequest.cpp
2018-10-09 00:23:01 +02:00
ixwebsocket/IXWebSocket.cpp
2018-12-30 08:15:27 +01:00
ixwebsocket/IXWebSocketServer.cpp
2018-10-09 00:23:01 +02:00
ixwebsocket/IXWebSocketTransport.cpp
ixwebsocket/IXWebSocketHandshake.cpp
ixwebsocket/IXWebSocketPerMessageDeflate.cpp
2019-01-05 02:28:13 +01:00
ixwebsocket/IXWebSocketPerMessageDeflateCodec.cpp
ixwebsocket/IXWebSocketPerMessageDeflateOptions.cpp
2018-10-09 00:23:01 +02:00
)
set( IXWEBSOCKET_HEADERS
ixwebsocket/IXEventFd.h
2018-10-09 00:23:01 +02:00
ixwebsocket/IXSocket.h
ixwebsocket/IXSocketServer.h
ixwebsocket/IXSocketConnect.h
2018-12-23 23:14:38 +01:00
ixwebsocket/IXSetThreadName.h
2018-12-15 01:28:11 +01:00
ixwebsocket/IXDNSLookup.h
2018-12-30 03:33:15 +01:00
ixwebsocket/IXCancellationRequest.h
ixwebsocket/IXProgressCallback.h
2018-10-09 00:23:01 +02:00
ixwebsocket/IXWebSocket.h
2018-12-30 08:15:27 +01:00
ixwebsocket/IXWebSocketServer.h
2018-10-09 00:23:01 +02:00
ixwebsocket/IXWebSocketTransport.h
ixwebsocket/IXWebSocketHandshake.h
2018-11-13 02:56:59 +01:00
ixwebsocket/IXWebSocketSendInfo.h
2018-12-30 03:33:15 +01:00
ixwebsocket/IXWebSocketErrorInfo.h
ixwebsocket/IXWebSocketPerMessageDeflate.h
2019-01-05 02:28:13 +01:00
ixwebsocket/IXWebSocketPerMessageDeflateCodec.h
ixwebsocket/IXWebSocketPerMessageDeflateOptions.h
ixwebsocket/IXWebSocketHttpHeaders.h
ixwebsocket/libwshandshake.hpp
2018-10-09 00:23:01 +02:00
)
2018-12-30 03:33:15 +01:00
# Platform specific code
if (APPLE)
list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/apple/IXSetThreadName_apple.cpp)
2019-01-05 02:28:13 +01:00
elseif (WIN32)
list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/windows/IXSetThreadName_windows.cpp)
2018-12-30 03:33:15 +01:00
else()
list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/linux/IXSetThreadName_linux.cpp)
endif()
2018-10-09 00:23:01 +02:00
if (USE_TLS)
add_definitions(-DIXWEBSOCKET_USE_TLS)
if (APPLE)
list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketAppleSSL.h)
list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketAppleSSL.cpp)
2018-12-30 03:33:15 +01:00
elseif (WIN32)
list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketSChannel.h)
list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketSChannel.cpp)
2018-10-09 00:23:01 +02:00
else()
list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketOpenSSL.h)
list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketOpenSSL.cpp)
endif()
endif()
add_library( ixwebsocket STATIC
${IXWEBSOCKET_SOURCES}
${IXWEBSOCKET_HEADERS}
)
2019-01-05 02:28:13 +01:00
# gcc/Linux needs -pthread
find_package(Threads)
if(UNIX AND NOT APPLE)
find_package(OpenSSL REQUIRED)
add_definitions(${OPENSSL_DEFINITIONS})
message(STATUS "OpenSSL: " ${OPENSSL_VERSION})
include_directories(${OPENSSL_INCLUDE_DIR})
endif()
if (WIN32)
get_filename_component(libz_path
${PROJECT_SOURCE_DIR}/third_party/ZLIB-Windows/zlib-1.2.11_deploy_v140/release_dynamic/x64/lib/zlib.lib
ABSOLUTE)
add_library(libz STATIC IMPORTED)
set_target_properties(libz PROPERTIES IMPORTED_LOCATION
${libz_path})
include_directories(${PROJECT_SOURCE_DIR}/third_party/ZLIB-Windows/zlib-1.2.11_deploy_v140/include)
target_link_libraries(ixwebsocket libz wsock32 ws2_32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
else()
target_link_libraries(ixwebsocket
z ${OPENSSL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
endif()
2018-10-09 00:23:01 +02:00
set( IXWEBSOCKET_INCLUDE_DIRS
.
../../shared/OpenSSL/include)
target_include_directories( ixwebsocket PUBLIC ${IXWEBSOCKET_INCLUDE_DIRS} )
add_subdirectory(ws)