refactor: no configure_openssl macro

This commit is contained in:
sithlord48
2024-12-01 20:21:22 -05:00
committed by Chris Rizzitello
parent 7ce2845c9b
commit 4e23460c6f
3 changed files with 25 additions and 25 deletions

View File

@ -90,6 +90,11 @@ project(
message(STATUS "Building ${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}")
# Set lib versions
set(REQUIRED_OPENSSL_VERSION 3.0)
set(REQUIRED_LIBEI_VERSION 1.3)
set(REQUIRED_LIBPORTAL_VERSION 0.8)
# Set required macOS SDK
if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET 12)

View File

@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set(LIBEI_MIN_VERSION 1.3)
set(LIBPORTAL_MIN_VERSION 0.8)
macro(configure_libs)
set(libs)
@ -35,7 +32,24 @@ macro(configure_libs)
endif()
configure_qt()
configure_openssl()
# TODO SSL check can happen in lib/net when we make wix packages with cpack
# Apple has to use static libraries because "Use of the Apple-provided OpenSSL
# libraries by apps is strongly discouraged."
# https://developer.apple.com/library/archive/documentation/Security/Conceptual/cryptoservices/SecureNetworkCommunicationAPIs/SecureNetworkCommunicationAPIs.html
if(APPLE)
set(OPENSSL_USE_STATIC_LIBS TRUE)
endif()
find_package(OpenSSL ${REQUIRED_OPENSSL_VERSION} REQUIRED COMPONENTS SSL Crypto)
if(WIN32) #Used for dev in TLS and WIX TODO RM when cpack used for wix
cmake_path(SET OPENSSL_ROOT_DIR NORMALIZE "${OPENSSL_INCLUDE_DIR}/..")
message(VERBOSE "Set OPENSSL_ROOT_DIR: ${OPENSSL_ROOT_DIR}")
set(OPENSSL_EXE_DIR "${OPENSSL_ROOT_DIR}/tools/openssl")
add_definitions(-DOPENSSL_EXE_DIR="${OPENSSL_EXE_DIR}")
endif()
option(ENABLE_COVERAGE "Enable test coverage" OFF)
if(ENABLE_COVERAGE)
@ -335,22 +349,3 @@ macro(configure_qt)
message(STATUS "Qt version: ${Qt6_VERSION}")
endmacro()
macro(configure_openssl)
# Apple has to use static libraries because "Use of the Apple-provided OpenSSL
# libraries by apps is strongly discouraged."
# https://developer.apple.com/library/archive/documentation/Security/Conceptual/cryptoservices/SecureNetworkCommunicationAPIs/SecureNetworkCommunicationAPIs.html
# TODO: How about bundling the OpenSSL .dylib files with the app so they can be updated?
if(APPLE)
set(OPENSSL_USE_STATIC_LIBS TRUE)
endif()
find_package(OpenSSL 3.0 REQUIRED COMPONENTS SSL Crypto)
if(WIN32) #Used for dev in TLS and WIX
cmake_path(SET OPENSSL_ROOT_DIR NORMALIZE "${OPENSSL_INCLUDE_DIR}/..")
message(VERBOSE "Set OPENSSL_ROOT_DIR: ${OPENSSL_ROOT_DIR}")
set(OPENSSL_EXE_DIR "${OPENSSL_ROOT_DIR}/tools/openssl")
add_definitions(-DOPENSSL_EXE_DIR="${OPENSSL_EXE_DIR}")
endif()
endmacro()

View File

@ -16,10 +16,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if(UNIX AND NOT APPLE)
pkg_check_modules(LIBEI REQUIRED QUIET "libei-1.0 >= 1.3")
pkg_check_modules(LIBEI REQUIRED QUIET "libei-1.0 >= ${REQUIRED_LIBEI_VERSION}")
message(STATUS "libei version: ${LIBEI_VERSION}")
pkg_check_modules(LIBPORTAL REQUIRED QUIET "libportal >= 0.8")
pkg_check_modules(LIBPORTAL REQUIRED QUIET "libportal >= ${REQUIRED_LIBPORTAL_VERSION}")
message(STATUS "libportal version: ${LIBPORTAL_VERSION}")
endif()