From 4047be8cc31e077ca5bf150e3e4baab4398d4d00 Mon Sep 17 00:00:00 2001 From: lb1107039128 Date: Thu, 1 Feb 2024 14:53:16 +0800 Subject: [PATCH] Export CMake Targets Signed-off-by: lb1107039128 --- 0001-Export-CMake-Targets.patch | 93 +++++++++++++++++++++++++++++++++ libsrtp.spec | 6 ++- 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 0001-Export-CMake-Targets.patch diff --git a/0001-Export-CMake-Targets.patch b/0001-Export-CMake-Targets.patch new file mode 100644 index 0000000..3fb4488 --- /dev/null +++ b/0001-Export-CMake-Targets.patch @@ -0,0 +1,93 @@ +From 38f5ccb11453fc2d612b06aa7a506c28d8f8363f Mon Sep 17 00:00:00 2001 +From: SE2Dev <5873790+SE2Dev@users.noreply.github.com> +Date: Wed, 13 Oct 2021 22:45:11 +0000 +Subject: [PATCH] Export CMake Targets + +--- + CMakeLists.txt | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- + Config.cmake.in | 3 +++ + 2 files changed, 49 insertions(+), 2 deletions(-) + create mode 100644 Config.cmake.in + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e15e851..4e47a2a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -240,7 +240,11 @@ add_library(srtp2 + + set_target_properties(srtp2 PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) + +-target_include_directories(srtp2 PUBLIC crypto/include include) ++target_include_directories(srtp2 PUBLIC ++ $ ++ $ ++ $ ++) + if(ENABLE_OPENSSL) + target_include_directories(srtp2 PRIVATE ${OPENSSL_INCLUDE_DIR}) + target_link_libraries(srtp2 OpenSSL::Crypto) +@@ -256,7 +260,10 @@ if(WIN32) + target_compile_definitions(srtp2 PUBLIC _CRT_SECURE_NO_WARNINGS) + endif() + +-install(TARGETS srtp2 DESTINATION lib) ++install(TARGETS srtp2 DESTINATION lib ++ EXPORT libSRTPTargets ++) ++ + install(FILES include/srtp.h crypto/include/auth.h + crypto/include/cipher.h + crypto/include/crypto_types.h +@@ -352,3 +359,40 @@ if(TEST_APPS) + endif() + endif() + endif() ++ ++# Export targets ++install( ++ EXPORT libSRTPTargets ++ FILE libSRTPTargets.cmake ++ NAMESPACE libSRTP:: ++ DESTINATION lib/cmake/libSRTP ++) ++ ++#-------------------------------------------------------------------- ++# Create generated files ++#-------------------------------------------------------------------- ++include(CMakePackageConfigHelpers) ++ ++# Generate the config file that is includes the exports ++configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in ++ "${CMAKE_CURRENT_BINARY_DIR}/libSRTPConfig.cmake" ++ INSTALL_DESTINATION "${CONFIG_FILE_DIR}" ++ NO_SET_AND_CHECK_MACRO ++ NO_CHECK_REQUIRED_COMPONENTS_MACRO ++) ++ ++# Generate the version file for the config file ++write_basic_package_version_file( ++ "${CMAKE_CURRENT_BINARY_DIR}/libSRTPConfigVersion.cmake" ++ VERSION "${CMAKE_PROJECT_VERSION}" ++ COMPATIBILITY AnyNewerVersion ++) ++ ++#-------------------------------------------------------------------- ++# Install CMake config files ++#-------------------------------------------------------------------- ++install(FILES ++ ${CMAKE_CURRENT_BINARY_DIR}/libSRTPConfig.cmake ++ ${CMAKE_CURRENT_BINARY_DIR}/libSRTPConfigVersion.cmake ++ DESTINATION lib/cmake/libSRTP ++) +diff --git a/Config.cmake.in b/Config.cmake.in +new file mode 100644 +index 0000000..0ad9b17 +--- /dev/null ++++ b/Config.cmake.in +@@ -0,0 +1,3 @@ ++@PACKAGE_INIT@ ++ ++include ( "${CMAKE_CURRENT_LIST_DIR}/libSRTPTargets.cmake" ) +-- +2.42.0.windows.2 + diff --git a/libsrtp.spec b/libsrtp.spec index 3fdf5ff..3e602a1 100644 --- a/libsrtp.spec +++ b/libsrtp.spec @@ -1,6 +1,6 @@ Name: libsrtp Version: 2.4.2 -Release: 3 +Release: 4 Summary: Library for SRTP (Secure Realtime Transport Protocol) License: BSD URL: https://github.com/cisco/libsrtp @@ -10,6 +10,7 @@ BuildRequires: gcc Patch0001: 0001-cast-time_t-values-to-known-types-for-formatting-in-.patch Patch0002: 0002-Include-directory-should-point-to-include-not-to-inc.patch +Patch0003: 0001-Export-CMake-Targets.patch %description This package provides an implementation of the Secure Real-time Transport Protocol (SRTP), @@ -50,6 +51,9 @@ development of %{name}. %{_libdir}/*.so %changelog +* Thu Feb 1 2024 liubo - 2.4.2-4 +- Export CMake Targets + * Wed Nov 22 2023 liubo - 2.4.2-3 - Include directory should point to 'include' not to 'include/srtp2'