mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-03-20 19:21:09 +01:00
Merge pull request #4259 from CJKay/cmake-config
Add CMake package config file
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
# until our infrastructure catches up.
|
||||
cmake_minimum_required(VERSION 3.5.1)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# https://cmake.org/cmake/help/latest/policy/CMP0011.html
|
||||
# Setting this policy is required in CMake >= 3.18.0, otherwise a warning is generated. The OLD
|
||||
# policy setting is deprecated, and will be removed in future versions.
|
||||
@@ -223,7 +225,6 @@ endif()
|
||||
add_subdirectory(include)
|
||||
|
||||
add_subdirectory(3rdparty)
|
||||
list(APPEND libs ${thirdparty_lib})
|
||||
|
||||
add_subdirectory(library)
|
||||
|
||||
@@ -302,3 +303,37 @@ if(ENABLE_TESTING)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl COPYONLY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
configure_package_config_file(
|
||||
"cmake/MbedTLSConfig.cmake.in"
|
||||
"cmake/MbedTLSConfig.cmake"
|
||||
INSTALL_DESTINATION "cmake")
|
||||
|
||||
write_basic_package_version_file(
|
||||
"cmake/MbedTLSConfigVersion.cmake"
|
||||
COMPATIBILITY SameMajorVersion
|
||||
VERSION 2.26.0)
|
||||
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/MbedTLSConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/MbedTLSConfigVersion.cmake"
|
||||
DESTINATION "cmake")
|
||||
|
||||
export(
|
||||
EXPORT MbedTLSTargets
|
||||
NAMESPACE MbedTLS::
|
||||
FILE "cmake/MbedTLSTargets.cmake")
|
||||
|
||||
install(
|
||||
EXPORT MbedTLSTargets
|
||||
NAMESPACE MbedTLS::
|
||||
DESTINATION "cmake"
|
||||
FILE "MbedTLSTargets.cmake")
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.14)
|
||||
# Do not export the package by default
|
||||
cmake_policy(SET CMP0090 NEW)
|
||||
|
||||
# Make this package visible to the system
|
||||
export(PACKAGE MbedTLS)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user