Browse Source

BugFixed: to perfer the specified openssl root path over the system version

industriousonesoft 4 years ago
parent
commit
75e891d40f
1 changed files with 7 additions and 0 deletions
  1. 7 0
      CMakeLists.txt

+ 7 - 0
CMakeLists.txt

@@ -283,6 +283,13 @@ if (USE_GNUTLS)
 	target_link_libraries(datachannel PRIVATE GnuTLS::GnuTLS)
 	target_link_libraries(datachannel-static PRIVATE GnuTLS::GnuTLS)
 else()
+	if(APPLE)
+		# This is a bug in CMake that causes it to prefer the system version over 
+		# the one in the specified ROOT folder
+		set(OPENSSL_ROOT_DIR ${OPENSSL_ROOT_DIR} "/usr/local/Cellar/[email protected]/1.1.1g/")
+		set(OPENSSL_CRYPTO_LIBRARY "${OPENSSL_ROOT_DIR}/lib/libcrypto.dylib" CACHE FILEPATH "" FORCE)
+		set(OPENSSL_SSL_LIBRARY "${OPENSSL_ROOT_DIR}/lib/libssl.dylib" CACHE FILEPATH "" FORCE)
+	endif()
 	find_package(OpenSSL REQUIRED)
 	target_compile_definitions(datachannel PRIVATE USE_GNUTLS=0)
 	target_compile_definitions(datachannel-static PRIVATE USE_GNUTLS=0)