From 66fdb92bb1ce593d2a0900e77b511ba8951dd538 Mon Sep 17 00:00:00 2001 From: Tomas Maly Date: Sun, 30 Jul 2023 13:49:09 +0200 Subject: [PATCH] test multiple crypto libraries on multiple versions of windows (Cherry-pick 6aa4e785c97da12f7ba087cd0a6af6cf3ca92ee7) --- CMakeLists.txt | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 61f3159..d1489cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,15 +84,17 @@ if (WIN32) string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - # - # Check whether BCrypt can be used with this SDK version - # - cmake_push_check_state() - set(CMAKE_REQUIRED_LIBRARIES bcrypt) - check_symbol_exists(BCryptEncrypt windows.h BCRYPT_AVAILABLE) - cmake_pop_check_state() - if (NOT BCRYPT_AVAILABLE AND USE_CRYPTO STREQUAL "BCrypt") - message(FATAL_ERROR "You're on Windows but BCrypt seems to be unavailable, you will need OpenSSL") + if (USE_CRYPTO STREQUAL "BCrypt") + # + # Check whether BCrypt can be used with this SDK version + # + cmake_push_check_state() + set(CMAKE_REQUIRED_LIBRARIES bcrypt) + check_symbol_exists(BCryptEncrypt windows.h BCRYPT_AVAILABLE) + cmake_pop_check_state() + if (NOT BCRYPT_AVAILABLE) + message(FATAL_ERROR "You're on Windows but BCrypt seems to be unavailable, you will need OpenSSL") + endif() endif() endif()