Don't enable ASM when OPENSSL_NO_ASM is set.

When building with OPENSSL_NO_ASM do not try to enable_language(ASM).
Even though the assembly source isn't being built this still causes
CMake to look for the assembler which will fail on platforms where one
is not available.

Change-Id: Ie4893f606143e8f8ca0807114068e577dc1e23e9
Reviewed-on: https://boringssl-review.googlesource.com/16904
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
Garret Kelly 2017-06-06 11:25:35 -04:00 committed by CQ bot account: commit-bot@chromium.org
parent cb34f8695d
commit e8ee947004

View File

@ -1,61 +1,63 @@
include_directories(../include) include_directories(../include)
if(UNIX) if(NOT OPENSSL_NO_ASM)
if (${ARCH} STREQUAL "aarch64") if(UNIX)
# The "armx" Perl scripts look for "64" in the style argument if (${ARCH} STREQUAL "aarch64")
# in order to decide whether to generate 32- or 64-bit asm. # The "armx" Perl scripts look for "64" in the style argument
if (APPLE) # in order to decide whether to generate 32- or 64-bit asm.
set(PERLASM_STYLE ios64) if (APPLE)
set(PERLASM_STYLE ios64)
else()
set(PERLASM_STYLE linux64)
endif()
elseif (${ARCH} STREQUAL "arm")
if (APPLE)
set(PERLASM_STYLE ios32)
else()
set(PERLASM_STYLE linux32)
endif()
elseif (${ARCH} STREQUAL "ppc64le")
set(PERLASM_STYLE linux64le)
else() else()
set(PERLASM_STYLE linux64) if (${ARCH} STREQUAL "x86")
set(PERLASM_FLAGS "-fPIC -DOPENSSL_IA32_SSE2")
endif()
if (APPLE)
set(PERLASM_STYLE macosx)
else()
set(PERLASM_STYLE elf)
endif()
endif() endif()
elseif (${ARCH} STREQUAL "arm") set(ASM_EXT S)
enable_language(ASM)
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack")
# Clang's integerated assembler does not support debug symbols.
if(NOT CMAKE_ASM_COMPILER_ID MATCHES "Clang")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,-g")
endif()
# CMake does not add -isysroot and -arch flags to assembly.
if (APPLE) if (APPLE)
set(PERLASM_STYLE ios32) if (CMAKE_OSX_SYSROOT)
else() set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
set(PERLASM_STYLE linux32) endif()
foreach(arch ${CMAKE_OSX_ARCHITECTURES})
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -arch ${arch}")
endforeach()
endif() endif()
elseif (${ARCH} STREQUAL "ppc64le")
set(PERLASM_STYLE linux64le)
else() else()
if (${ARCH} STREQUAL "x86") if (CMAKE_CL_64)
set(PERLASM_FLAGS "-fPIC -DOPENSSL_IA32_SSE2") set(PERLASM_STYLE nasm)
endif()
if (APPLE)
set(PERLASM_STYLE macosx)
else() else()
set(PERLASM_STYLE elf) set(PERLASM_STYLE win32n)
set(PERLASM_FLAGS "-DOPENSSL_IA32_SSE2")
endif() endif()
endif()
set(ASM_EXT S)
enable_language(ASM)
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack")
# Clang's integerated assembler does not support debug symbols. # On Windows, we use the NASM output, specifically built with Yasm.
if(NOT CMAKE_ASM_COMPILER_ID MATCHES "Clang") set(ASM_EXT asm)
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,-g") enable_language(ASM_NASM)
endif() endif()
# CMake does not add -isysroot and -arch flags to assembly.
if (APPLE)
if (CMAKE_OSX_SYSROOT)
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
endif()
foreach(arch ${CMAKE_OSX_ARCHITECTURES})
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -arch ${arch}")
endforeach()
endif()
else()
if (CMAKE_CL_64)
set(PERLASM_STYLE nasm)
else()
set(PERLASM_STYLE win32n)
set(PERLASM_FLAGS "-DOPENSSL_IA32_SSE2")
endif()
# On Windows, we use the NASM output, specifically built with Yasm.
set(ASM_EXT asm)
enable_language(ASM_NASM)
endif() endif()
function(perlasm dest src) function(perlasm dest src)