option(WITHOUT_EXTENSIONS "Don't compile with extensions" OFF)
option(WITH_LATENCY "Build latency measuring code into the library" OFF)
option(WITHOUT_DAEMONIZE "Don't build the daemonization api" OFF)
+option(WITH_SD_DAEMON "Build support for systemd based socket activation" OFF)
if (WITHOUT_CLIENT AND WITHOUT_SERVER)
message(FATAL_ERROR "Makes no sense to compile without both client or server.")
${WIN32_HELPERS_PATH}/websock-w32.h
${WIN32_HELPERS_PATH}/gettimeofday.h
)
-
+if (MINGW)
+ list(APPEND SOURCES
+ ${WIN32_HELPERS_PATH}/gettimeofday.c
+ )
+else()
list(APPEND SOURCES
${WIN32_HELPERS_PATH}/websock-w32.c
${WIN32_HELPERS_PATH}/gettimeofday.c
)
-
+endif()
include_directories(${WIN32_HELPERS_PATH})
else()
# Unix.
#
#
+# SD_DAEMON (Only needed if systemd socket activation is desired.)
+#
+if (WITH_SD_DAEMON)
+ find_package(PkgConfig)
+ pkg_check_modules(SD_DAEMON REQUIRED libsystemd-daemon)
+
+ include_directories(${SD_DAEMON_INCLUDE_DIRS})
+ list(APPEND LIB_LIST ${SD_DAEMON_LIBRARIES})
+ add_definitions(${SD_DAEMON_CFLAGS_OTHER})
+ add_definitions(-DHAVE_SYSTEMD_DAEMON)
+endif()
+
+#
# ZLIB (Only needed for deflate extensions).
#
if (NOT WITHOUT_EXTENSIONS)
# Data files for running the test server.
set(TEST_SERVER_DATA
- test-server/favicon.ico
- test-server/leaf.jpg
- test-server/libwebsockets.org-logo.png
- test-server/test.html)
+ ${PROJECT_SOURCE_DIR}/test-server/favicon.ico
+ ${PROJECT_SOURCE_DIR}/test-server/leaf.jpg
+ ${PROJECT_SOURCE_DIR}/test-server/libwebsockets.org-logo.png
+ ${PROJECT_SOURCE_DIR}/test-server/test.html)
# Generate self-signed SSL certs for the test-server.
if (WITH_SSL AND OPENSSL_EXECUTABLE)
COMMAND "${OPENSSL_EXECUTABLE}" req -new -newkey rsa:1024 -days 10000 -nodes -x509 -keyout "${TEST_SERVER_SSL_KEY}" -out "${TEST_SERVER_SSL_CERT}"
RESULT_VARIABLE OPENSSL_RETURN_CODE)
+ message("\n")
+
if (OPENSSL_RETURN_CODE)
message("!!! Failed to generate SSL certificate:\n${OPENSSL_RETURN_CODE} !!!")
endif()
${TEST_SERVER_SSL_KEY}
${TEST_SERVER_SSL_CERT})
endif()
+
+ # Copy the file needed to run the server so that the test apps can
+ # reach them from their default output location
+ foreach (TEST_FILE ${TEST_SERVER_DATA})
+ add_custom_command(TARGET test-server
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:test-server>/../share/libwebsockets-test-server"
+ COMMAND ${CMAKE_COMMAND} -E copy ${TEST_FILE} "$<TARGET_FILE_DIR:test-server>/../share/libwebsockets-test-server" VERBATIM)
+ endforeach()
endif(NOT WITHOUT_SERVER)
if (NOT WITHOUT_CLIENT)
file(WRITE ${PROJECT_BINARY_DIR}/libwebsockets.pc
"prefix=/usr/local
exec_prefix=\${prefix}
-libdir=\${exec_prefix}/lib
+libdir=\${exec_prefix}/lib${LIB_SUFFIX}
includedir=\${prefix}/include
Name: libwebsockets
)
install(FILES ${PROJECT_BINARY_DIR}/libwebsockets.pc
- DESTINATION include/pkgconfig)
+ DESTINATION lib${LIB_SUFFIX}/pkgconfig)
endif()
# Install headers.
# Install libs.
install(TARGETS websockets websockets_shared
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib${LIB_SUFFIX}
+ ARCHIVE DESTINATION lib${LIB_SUFFIX}
COMPONENT libraries)
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")