Skip to content

Commit

Permalink
cmake: limit WinCNG to Windows
Browse files Browse the repository at this point in the history
After deleting the `bcrypt.h` check, no check remained. Restore
a `WIN32` check here to ensure WinCNG is not enabled outside Windows.

Follow-up to 1289033

Tested-in libssh2#1032
  • Loading branch information
vszakats committed May 5, 2023
1 parent 1458e28 commit e36b21d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -390,12 +390,16 @@ endif()
# Detect platform-specific crypto-backends last:

if(CRYPTO_BACKEND STREQUAL "WinCNG" OR NOT CRYPTO_BACKEND)
set(CRYPTO_BACKEND "WinCNG")
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_WINCNG")
set(CRYPTO_BACKEND_INCLUDE_DIR "")

list(APPEND LIBRARIES crypt32 bcrypt)
list(APPEND PC_LIBS -lcrypt32 -lbcrypt)
if(WIN32)
set(CRYPTO_BACKEND "WinCNG")
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_WINCNG")
set(CRYPTO_BACKEND_INCLUDE_DIR "")

list(APPEND LIBRARIES crypt32 bcrypt)
list(APPEND PC_LIBS -lcrypt32 -lbcrypt)
elseif(${SPECIFIC_CRYPTO_REQUIREMENT} STREQUAL ${REQUIRED})
message(FATAL_ERROR "WinCNG not available")
endif()
endif()

# Global functions

0 comments on commit e36b21d

Please sign in to comment.