@@ -33,12 +33,10 @@ add_feature_info(
3333
3434cmake_dependent_option(
3535  EXT_MYSQLND_SSL
36-   "Explicitly enable extended SSL support in the mysqlnd extension when\  
37-   building without openssl extension (EXT_OPENSSL=OFF) or when using phpize. If\  
38-   the openssl extension is enabled at the configure step (EXT_OPENSSL=ON),\  
39-   extended SSL is enabled implicitly regardless of this option." 
36+   "Explicitly enable extended SSL support in the mysqlnd extension through a\  
37+   system library OpenSSL (*nix) or Crypt32 (Windows)." 
4038  OFF 
41-   " EXT_MYSQLND; NOT EXT_OPENSSL" 
39+   [[ EXT_MYSQLND AND  NOT EXT_OPENSSL AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows"]] 
4240  OFF 
4341)
4442
@@ -118,20 +116,29 @@ set(MYSQLND_SSL_SUPPORTED 1 CACHE INTERNAL "Enable core mysqlnd SSL code")
118116# A deferred configuration, so it is executed after the openssl extension to 
119117# have the EXT_OPENSSL variable available. 
120118function (php_mysqlnd_post_configuration)
121-   if (EXT_MYSQLND_SSL OR  EXT_OPENSSL)
122-     find_package (OpenSSL ${PHP_OPENSSL_MIN_VERSION} )
123-     set_package_properties(
124-       OpenSSL
125-       PROPERTIES
126-         TYPE  REQUIRED
127-         PURPOSE "Necessary to enable SSL in the mysqlnd extension." 
119+   if (
120+     (
121+       NOT  CMAKE_SYSTEM_NAME  STREQUAL  "Windows" 
122+       AND  (EXT_MYSQLND_SSL OR  EXT_OPENSSL)
128123    )
129- 
130-     target_link_libraries (php_mysqlnd PRIVATE  OpenSSL::Crypto)
124+     OR  CMAKE_SYSTEM_NAME  STREQUAL  "Windows" 
125+   )
126+     if (CMAKE_SYSTEM_NAME  STREQUAL  "Windows" )
127+       target_link_libraries (php_mysqlnd PRIVATE  crypt32)
128+     else ()
129+       find_package (OpenSSL ${PHP_OPENSSL_MIN_VERSION} )
130+       set_package_properties(
131+         OpenSSL
132+         PROPERTIES
133+           TYPE  REQUIRED
134+           PURPOSE "Necessary to enable SSL in the mysqlnd extension." 
135+       )
136+       target_link_libraries (php_mysqlnd PRIVATE  OpenSSL::Crypto)
137+     endif ()
131138
132139    set (
133140      MYSQLND_HAVE_SSL 1
134-       CACHE  INTERNAL  "Enable mysqlnd extended SSL that uses OpenSSL directly " 
141+       CACHE  INTERNAL  "Enable mysqlnd extended SSL" 
135142    )
136143
137144    add_dependencies (php_mysqlnd php_hash)
@@ -140,7 +147,7 @@ function(php_mysqlnd_post_configuration)
140147  add_feature_info(
141148    "ext/mysqlnd SSL" 
142149    MYSQLND_HAVE_SSL
143-     "Extended SSL support through OpenSSL " 
150+     "Extended SSL support through a system library " 
144151  )
145152endfunction ()
146153
0 commit comments