mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 13:59:06 +08:00
1baf31a668
* Install openssl.pc * Add pc files for Windows * Use pkg-config friendly lib names without extension * Update versions
74 lines
2.9 KiB
CMake
74 lines
2.9 KiB
CMake
set(OPENSSL_ROOT_DIR_BAK ${OPENSSL_ROOT_DIR})
|
|
get_filename_component(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
get_filename_component(OPENSSL_ROOT_DIR "${OPENSSL_ROOT_DIR}" PATH)
|
|
get_filename_component(OPENSSL_ROOT_DIR "${OPENSSL_ROOT_DIR}" PATH)
|
|
|
|
if(CMAKE_HOST_WIN32)
|
|
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" Z_VCPKG_PROGRAMFILES)
|
|
set(Z_VCPKG_PROGRAMFILESX86_NAME "PROGRAMFILES(x86)")
|
|
file(TO_CMAKE_PATH "$ENV{${Z_VCPKG_PROGRAMFILESX86_NAME}}" Z_VCPKG_PROGRAMFILESX86)
|
|
set(CMAKE_SYSTEM_IGNORE_PATH
|
|
"${Z_VCPKG_PROGRAMFILES}/OpenSSL"
|
|
"${Z_VCPKG_PROGRAMFILES}/OpenSSL-Win32"
|
|
"${Z_VCPKG_PROGRAMFILES}/OpenSSL-Win64"
|
|
"${Z_VCPKG_PROGRAMFILES}/OpenSSL-Win32/lib/VC"
|
|
"${Z_VCPKG_PROGRAMFILES}/OpenSSL-Win64/lib/VC"
|
|
"${Z_VCPKG_PROGRAMFILES}/OpenSSL-Win32/lib/VC/static"
|
|
"${Z_VCPKG_PROGRAMFILES}/OpenSSL-Win64/lib/VC/static"
|
|
"${Z_VCPKG_PROGRAMFILESX86}/OpenSSL"
|
|
"${Z_VCPKG_PROGRAMFILESX86}/OpenSSL-Win32"
|
|
"${Z_VCPKG_PROGRAMFILESX86}/OpenSSL-Win64"
|
|
"${Z_VCPKG_PROGRAMFILESX86}/OpenSSL-Win32/lib/VC"
|
|
"${Z_VCPKG_PROGRAMFILESX86}/OpenSSL-Win64/lib/VC"
|
|
"${Z_VCPKG_PROGRAMFILESX86}/OpenSSL-Win32/lib/VC/static"
|
|
"${Z_VCPKG_PROGRAMFILESX86}/OpenSSL-Win64/lib/VC/static"
|
|
"C:/OpenSSL/"
|
|
"C:/OpenSSL-Win32/"
|
|
"C:/OpenSSL-Win64/"
|
|
"C:/OpenSSL-Win32/lib/VC"
|
|
"C:/OpenSSL-Win64/lib/VC"
|
|
"C:/OpenSSL-Win32/lib/VC/static"
|
|
"C:/OpenSSL-Win64/lib/VC/static"
|
|
)
|
|
endif()
|
|
|
|
_find_package(${ARGS})
|
|
|
|
set(OPENSSL_ROOT_DIR ${OPENSSL_ROOT_DIR_BAK})
|
|
|
|
if(OPENSSL_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
|
|
if(WIN32)
|
|
list(APPEND OPENSSL_LIBRARIES crypt32 ws2_32)
|
|
if(TARGET OpenSSL::Crypto)
|
|
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "crypt32;ws2_32")
|
|
endif()
|
|
if(TARGET OpenSSL::SSL)
|
|
set_property(TARGET OpenSSL::SSL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "crypt32;ws2_32")
|
|
endif()
|
|
else()
|
|
cmake_policy(PUSH)
|
|
cmake_policy(SET CMP0057 NEW)
|
|
find_library(OPENSSL_DL_LIBRARY NAMES dl)
|
|
if(OPENSSL_DL_LIBRARY)
|
|
list(APPEND OPENSSL_LIBRARIES "dl")
|
|
if(TARGET OpenSSL::Crypto)
|
|
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "dl")
|
|
endif()
|
|
endif()
|
|
|
|
if("REQUIRED" IN_LIST ARGS)
|
|
find_package(Threads REQUIRED)
|
|
else()
|
|
find_package(Threads)
|
|
endif()
|
|
list(APPEND OPENSSL_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
|
if(TARGET OpenSSL::Crypto)
|
|
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "Threads::Threads")
|
|
endif()
|
|
if(TARGET OpenSSL::SSL)
|
|
set_property(TARGET OpenSSL::SSL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "Threads::Threads")
|
|
endif()
|
|
cmake_policy(POP)
|
|
endif()
|
|
endif()
|