mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-18 15:20:56 +03:00
* Use the imported target of FindOpenSSL module * Build libssh2 before test runner * Use find_package() in the CMake config file * Use find_dependency() rather than find_package() * Install CMake module files and use them in the config file * Use elseif() to choose the crypto backend
32 lines
912 B
CMake
32 lines
912 B
CMake
# Copyright (C) The libssh2 project and its contributors.
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
include(CMakeFindDependencyMacro)
|
|
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
|
|
|
if("@CRYPTO_BACKEND@" STREQUAL "OpenSSL")
|
|
find_dependency(OpenSSL)
|
|
elseif("@CRYPTO_BACKEND@" STREQUAL "wolfSSL")
|
|
find_package(wolfssl)
|
|
elseif("@CRYPTO_BACKEND@" STREQUAL "Libgcrypt")
|
|
find_package(Libgcrypt)
|
|
elseif("@CRYPTO_BACKEND@" STREQUAL "mbedTLS")
|
|
find_package(mbedTLS)
|
|
endif()
|
|
|
|
if(@ZLIB_FOUND@)
|
|
find_dependency(ZLIB)
|
|
endif()
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
|
|
|
|
# Alias for either shared or static library
|
|
if(NOT TARGET @PROJECT_NAME@::@LIB_NAME@)
|
|
add_library(@PROJECT_NAME@::@LIB_NAME@ ALIAS @PROJECT_NAME@::@LIB_SELECTED@)
|
|
endif()
|
|
|
|
# Compatibility alias
|
|
if(NOT TARGET Libssh2::@LIB_NAME@)
|
|
add_library(Libssh2::@LIB_NAME@ ALIAS @PROJECT_NAME@::@LIB_SELECTED@)
|
|
endif()
|