qt5base-lts/cmake/FindWrapOpenSSL.cmake
Martin Storsjö 236ae73ed8 Lowercase system includes and lib names for Windows, fix cross compiling
When cross compiling from a case sensitive file system, casing
matters, and mingw headers and import libraries consistently
use lowercase.

This was uncovered by d385158d5213ef568b7629e2aa4a818016bbffac;
prior to that, the schannel TLS plugin didn't end up built (at
least when cross compiling).

Fix other similar cases that can be found by grepping the repo.

Change-Id: Ia696e17b7aaa979d7b7f5b0801383f338a8b585b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-04-23 14:31:04 +03:00

34 lines
1.1 KiB
CMake

# We can't create the same interface imported target multiple times, CMake will complain if we do
# that. This can happen if the find_package call is done in multiple different subdirectories.
if(TARGET WrapOpenSSL::WrapOpenSSL)
set(WrapOpenSSL_FOUND ON)
return()
endif()
set(WrapOpenSSL_FOUND OFF)
# Reuse logic from the headers find script.
find_package(WrapOpenSSLHeaders ${WrapOpenSSL_FIND_VERSION})
if(OpenSSL_FOUND)
if(WIN32)
get_target_property(libType OpenSSL::Crypto TYPE)
if(libType STREQUAL "ALIAS")
get_target_property(writableLib OpenSSL::Crypto ALIASED_TARGET)
else()
set(writableLib OpenSSL::Crypto)
endif()
set_property(TARGET ${writableLib} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ws2_32 crypt32)
unset(libType)
unset(writableLib)
endif()
set(WrapOpenSSL_FOUND ON)
add_library(WrapOpenSSL::WrapOpenSSL INTERFACE IMPORTED)
target_link_libraries(WrapOpenSSL::WrapOpenSSL INTERFACE OpenSSL::SSL)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WrapOpenSSL DEFAULT_MSG WrapOpenSSL_FOUND)