From da217f13d734fe51ccc2d9b986d5f16ccba14bdd Mon Sep 17 00:00:00 2001 From: janbar Date: Thu, 30 Nov 2023 21:22:00 +0100 Subject: [PATCH] configure the package config file openssl.pc --- CMakeLists.txt | 9 +++++++++ crypto/CMakeLists.txt | 6 +++--- openssl.pc.in.cmake | 10 ++++++++++ ssl/CMakeLists.txt | 6 +++--- 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 openssl.pc.in.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a63448d..e93be8fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,6 +203,15 @@ install( FILES install( DIRECTORY doc DESTINATION share ) +set( prefix "${CMAKE_INSTALL_PREFIX}" ) +set( includedir "include" ) +set( libdir "lib" ) +get_target_property( libcrypto crypto OUTPUT_NAME ) +get_target_property( libssl ssl OUTPUT_NAME ) +configure_file(openssl.pc.in.cmake openssl.pc @ONLY) +install (FILES ${CMAKE_CURRENT_BINARY_DIR}/openssl.pc + DESTINATION lib/pkgconfig) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 2aba30a1..eccff7fe 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -298,14 +298,14 @@ set_target_properties( crypto PROPERTIES if( ANDROID ) set_target_properties( crypto PROPERTIES OUTPUT_NAME "crypto_1_1" ) -endif() - -if( MSVC ) +elseif( MSVC ) if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) set_target_properties( crypto PROPERTIES OUTPUT_NAME "crypto-1_1-x64" ) elseif( CMAKE_SIZEOF_VOID_P EQUAL 4 ) set_target_properties( crypto PROPERTIES OUTPUT_NAME "crypto-1_1" ) endif() +else() + set_target_properties( crypto PROPERTIES OUTPUT_NAME "crypto" ) endif() install( TARGETS crypto diff --git a/openssl.pc.in.cmake b/openssl.pc.in.cmake new file mode 100644 index 00000000..2a7cd56d --- /dev/null +++ b/openssl.pc.in.cmake @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=${exec_prefix}/@libdir@ +includedir=${prefix}/@includedir@ + +Name: OpenSSL +Description: Secure Sockets Layer and cryptography libraries and tools +Version: @VERSION_STRING@ +Libs: -L${libdir} -l@libssl@ -l@libcrypto@ + diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt index a1ff7445..e7323028 100644 --- a/ssl/CMakeLists.txt +++ b/ssl/CMakeLists.txt @@ -54,14 +54,14 @@ set_target_properties( ssl PROPERTIES if( ANDROID ) set_target_properties( ssl PROPERTIES OUTPUT_NAME "ssl_1_1" ) -endif() - -if( MSVC ) +elseif( MSVC ) if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) set_target_properties( ssl PROPERTIES OUTPUT_NAME "ssl-1_1-x64" ) elseif( CMAKE_SIZEOF_VOID_P EQUAL 4 ) set_target_properties( ssl PROPERTIES OUTPUT_NAME "ssl-1_1" ) endif() +else() + set_target_properties( ssl PROPERTIES OUTPUT_NAME "ssl" ) endif() install( TARGETS ssl