From bc765e73a31ea5372e36d1b1add036af3218cb17 Mon Sep 17 00:00:00 2001 From: lanthora Date: Wed, 26 Apr 2023 02:54:25 +0800 Subject: [PATCH] Add pkgconfig file (#459) --- CMakeLists.txt | 8 +++++++- ixwebsocket.pc.in | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 ixwebsocket.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 4220939c..791ae572 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,7 @@ if (USE_TLS) else() # default to OpenSSL on all other platforms if (NOT USE_MBED_TLS) # Unless mbedtls is requested set(USE_OPEN_SSL ON) + set(requires "openssl") endif() endif() @@ -167,7 +168,8 @@ if(BUILD_SHARED_LIBS) ) # Set library version - set_target_properties(ixwebsocket PROPERTIES VERSION 11.3.2) + set(version 11.3.2) + set_target_properties(ixwebsocket PROPERTIES VERSION ${version}) else() # Static library @@ -290,6 +292,10 @@ if (IXWEBSOCKET_INSTALL) configure_file("${CMAKE_CURRENT_LIST_DIR}/ixwebsocket-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/ixwebsocket-config.cmake" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ixwebsocket-config.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ixwebsocket") + set(prefix ${CMAKE_INSTALL_PREFIX}) + configure_file("${CMAKE_CURRENT_LIST_DIR}/ixwebsocket.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/ixwebsocket.pc" @ONLY) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ixwebsocket.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + install(EXPORT ixwebsocket FILE ixwebsocket-targets.cmake NAMESPACE ixwebsocket:: diff --git a/ixwebsocket.pc.in b/ixwebsocket.pc.in new file mode 100644 index 00000000..d1c2813e --- /dev/null +++ b/ixwebsocket.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: ixwebsocket +Description: websocket and http client and server library, with TLS support and very few dependencies +Version: @version@ +Libs: -L${libdir} -lixwebsocket +Cflags: -I${includedir} +Requires: @requires@