@@ -240,7 +240,11 @@ add_library(srtp2
240
240
241
241
set_target_properties (srtp2 PROPERTIES VERSION ${CMAKE_PROJECT_VERSION} )
242
242
243
- target_include_directories (srtp2 PUBLIC crypto/include include )
243
+ target_include_directories (srtp2 PUBLIC
244
+ $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /crypto/include>
245
+ $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>
246
+ $< INSTALL_INTERFACE:include>
247
+ )
244
248
if (ENABLE_OPENSSL )
245
249
target_include_directories (srtp2 PRIVATE ${OPENSSL_INCLUDE_DIR} )
246
250
target_link_libraries (srtp2 OpenSSL::Crypto )
@@ -256,7 +260,10 @@ if(WIN32)
256
260
target_compile_definitions (srtp2 PUBLIC _CRT_SECURE_NO_WARNINGS )
257
261
endif ()
258
262
259
- install (TARGETS srtp2 DESTINATION lib )
263
+ install (TARGETS srtp2 DESTINATION lib
264
+ EXPORT libSRTPTargets
265
+ )
266
+
260
267
install (FILES include /srtp.h crypto/include/auth.h
261
268
crypto/include/cipher.h
262
269
crypto/include/crypto_types.h
@@ -352,3 +359,40 @@ if(TEST_APPS)
352
359
endif ()
353
360
endif ()
354
361
endif ()
362
+
363
+ # Export targets
364
+ install (
365
+ EXPORT libSRTPTargets
366
+ FILE libSRTPTargets.cmake
367
+ NAMESPACE libSRTP::
368
+ DESTINATION lib/cmake/libSRTP
369
+ )
370
+
371
+ #--------------------------------------------------------------------
372
+ # Create generated files
373
+ #--------------------------------------------------------------------
374
+ include (CMakePackageConfigHelpers )
375
+
376
+ # Generate the config file that is includes the exports
377
+ configure_package_config_file (${CMAKE_CURRENT_SOURCE_DIR} /Config.cmake.in
378
+ "${CMAKE_CURRENT_BINARY_DIR} /libSRTPConfig.cmake"
379
+ INSTALL_DESTINATION "${CONFIG_FILE_DIR} "
380
+ NO_SET_AND_CHECK_MACRO
381
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
382
+ )
383
+
384
+ # Generate the version file for the config file
385
+ write_basic_package_version_file (
386
+ "${CMAKE_CURRENT_BINARY_DIR} /libSRTPConfigVersion.cmake"
387
+ VERSION "${CMAKE_PROJECT_VERSION} "
388
+ COMPATIBILITY AnyNewerVersion
389
+ )
390
+
391
+ #--------------------------------------------------------------------
392
+ # Install CMake config files
393
+ #--------------------------------------------------------------------
394
+ install (FILES
395
+ ${CMAKE_CURRENT_BINARY_DIR} /libSRTPConfig.cmake
396
+ ${CMAKE_CURRENT_BINARY_DIR} /libSRTPConfigVersion.cmake
397
+ DESTINATION lib/cmake/libSRTP
398
+ )
0 commit comments