!40 Export CMake Targets
From: @lb1107039128 Reviewed-by: @Charlie_li Signed-off-by: @Charlie_li
This commit is contained in:
commit
33b267af12
93
0001-Export-CMake-Targets.patch
Normal file
93
0001-Export-CMake-Targets.patch
Normal file
@ -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
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/crypto/include>
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
+ $<INSTALL_INTERFACE:/include>
|
||||
+)
|
||||
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
|
||||
|
||||
@ -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 <liubo1@xfusion.com> - 2.4.2-4
|
||||
- Export CMake Targets
|
||||
|
||||
* Wed Nov 22 2023 liubo <liubo1@xfusion.com> - 2.4.2-3
|
||||
- Include directory should point to 'include' not to 'include/srtp2'
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user