aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJan Tattermusch <jtattermusch@users.noreply.github.com>2019-12-17 13:45:33 +0100
committerGitHub <noreply@github.com>2019-12-17 13:45:33 +0100
commitb5c3056d2574ffd94c44e2174cdc4e08c56a47ec (patch)
tree82447a12252a4000c9009eac70926368de922aea /cmake
parent2e4ebd7478c58d119210b5b68e929e7098282f9c (diff)
parent5f073edc8f4437de0b5745d2b16eacc2ade27848 (diff)
downloadgrpc-grpc-b5c3056d2574ffd94c44e2174cdc4e08c56a47ec.tar.gz
Merge pull request #21427 from zackgalbreath/cmake_ssl_assembly
Conditionally enable OPENSSL_NO_ASM for Visual Studio
Diffstat (limited to 'cmake')
-rw-r--r--cmake/ssl.cmake25
1 files changed, 18 insertions, 7 deletions
diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake
index 1389be32b6..d42720efd6 100644
--- a/cmake/ssl.cmake
+++ b/cmake/ssl.cmake
@@ -20,15 +20,26 @@ if(gRPC_SSL_PROVIDER STREQUAL "module")
if(NOT BORINGSSL_ROOT_DIR)
set(BORINGSSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/boringssl)
endif()
+
if(EXISTS "${BORINGSSL_ROOT_DIR}/CMakeLists.txt")
- if (MSVC AND NOT CMAKE_GENERATOR STREQUAL "Ninja")
- # Visual Studio build with assembly optimizations is broken,
- # but it works with Ninja generator.
- # This will get eventually fixed in cmake, but until then
- # we need to disable assembly optimizations.
- # See https://github.com/grpc/grpc/issues/16376
- set(OPENSSL_NO_ASM ON)
+ if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ if(CMAKE_VERSION VERSION_LESS 3.13)
+ # Visual Studio build with assembly optimizations is broken for older
+ # version of CMake (< 3.13).
+ message(WARNING "Disabling SSL assembly support because CMake version ${CMAKE_VERSION} is too old (less than 3.13)")
+ set(OPENSSL_NO_ASM ON)
+ else()
+ # If we're using a new enough version of CMake, make sure that the
+ # NASM assembler can be found.
+ include(CheckLanguage)
+ check_language(ASM_NASM)
+ if(NOT CMAKE_ASM_NASM_COMPILER)
+ message(WARNING "Disabling SSL assembly support because NASM could not be found")
+ set(OPENSSL_NO_ASM ON)
+ endif()
+ endif()
endif()
+
add_subdirectory(${BORINGSSL_ROOT_DIR} third_party/boringssl)
if(TARGET ssl)
set(_gRPC_SSL_LIBRARIES ssl)