File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ option(GPGFRONTEND_XCODE_ENABLE_SANDBOX "Enable SandBox For Xcode Build" OFF)
7070
7171# check options
7272option (GPGFRONTEND_LINK_GPGME_INTO_CORE "Statically link GpgME into the core library" OFF )
73+ option (GPGFRONTEND_USE_SYSTEM_OPENSSL "Use system OpenSSL instead of building it" OFF )
7374option (GPGFRONTEND_RUST_SUPPORT "Enable Rust support for GpgFrontend" OFF )
7475
7576if (GPGFRONTEND_BUILD_APP_IMAGE)
@@ -107,6 +108,12 @@ else()
107108 set (BUILD_AND_STATIC_LINK_GPGME 0)
108109endif ()
109110
111+ if (GPGFRONTEND_USE_SYSTEM_OPENSSL)
112+ set (USE_SYSTEM_OPENSSL 1)
113+ else ()
114+ set (USE_SYSTEM_OPENSSL 0)
115+ endif ()
116+
110117if (GPGFRONTEND_RUST_SUPPORT)
111118 set (BUILD_RUST_SUPPORT 1)
112119else ()
@@ -247,6 +254,12 @@ if(MINGW)
247254
248255 set (OS_PLATFORM 0)
249256
257+ # for mingw, we will always use the system openssl, since it's easier to get
258+ # it working on windows and the openssl project provides official pre-built
259+ # binaries for windows. And in the msys2 environment, the openssl is also
260+ # available as a package, and it's often the latest version.
261+ set (USE_SYSTEM_OPENSSL 1)
262+
250263 include_directories (
251264 ${CMAKE_CURRENT_SOURCE_DIR} /src
252265 ${CMAKE_CURRENT_SOURCE_DIR} /third_party
Original file line number Diff line number Diff line change @@ -201,21 +201,19 @@ if(BUILD_AND_STATIC_LINK_GPGME AND XCODE_BUILD)
201201 target_link_libraries (GnuPGDeps INTERFACE ${GPGME_STATIC_LIB} ${ASSUAN_STATIC_LIB} ${GPG_ERROR_STATIC_LIB} )
202202endif ()
203203
204- # Introduce OpenSSL
205- if (MINGW)
206- # since OpenSSL on msys2 is often the latest version and is well maintained ,
207- # and it's better to use it to avoid build issues.
204+ # Introduce OpenSSL targets
205+ if (USE_SYSTEM_OPENSSL)
208206 set (SYSTEM_OPENSSL ON )
209207 set (BUILD_OPENSSL OFF )
210- # static linking on Windows for better security and portability, and it's
211- # generally recommended for OpenSSL on Windows.
212- set (OPENSSL_USE_STATIC_LIBS ON )
213208else ()
214209 set (SYSTEM_OPENSSL OFF )
215210 set (BUILD_OPENSSL ON )
216211endif ()
217212
218213set (OPENSSL_BUILD_VERSION "3.6.1" )
214+ # We will always use static libraries for openssl for the support of application
215+ # self-checking. This may avoid the potential issues of corrupted shared library
216+ # loading.
219217set (OPENSSL_USE_STATIC_LIBS ON )
220218add_subdirectory (openssl-cmake )
221219
You can’t perform that action at this time.
0 commit comments