Skip to content

Commit d14347d

Browse files
authored
Minor build fixes for CMake and libssl on x86 (#2267)
### Description of changes: * Removes unnecessary variable evaluation in a handful of if statements for `CMAKE_SYSTEM_PROCESSOR_LOWER`. These can result in a failure if `CMAKE_SYSTEM_PROCESSOR_LOWER` is an empty string as the `${}` is expanded first in the if-statement due to historical reasons. * `libssl` can fail to compile if building on x86 since we don't pass `-msse2` to the C++ compiler. This is due to the fact that the `crypto/internal.h` is included by libssl and it explicitly checks for SSE2 support. See https://github.com/aws/aws-lc/blob/main/crypto/internal.h#L203-L214 ### Testing * Verified build with a modified `./util/32-bit-toolchain.cmake` that only sets `-m32` (since building on an x86-64 platform). By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
1 parent 087fdc0 commit d14347d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -844,11 +844,11 @@ elseif(CMAKE_SYSTEM_PROCESSOR_LOWER MATCHES "^arm*")
844844
set(ARCH "arm")
845845
elseif(CMAKE_SYSTEM_PROCESSOR_LOWER MATCHES "powerpc64le|ppc64le")
846846
set(ARCH "ppc64le")
847-
elseif (${CMAKE_SYSTEM_PROCESSOR_LOWER} STREQUAL "riscv64")
847+
elseif(CMAKE_SYSTEM_PROCESSOR_LOWER STREQUAL "riscv64")
848848
set(ARCH "riscv64")
849-
elseif (${CMAKE_SYSTEM_PROCESSOR_LOWER} STREQUAL "s390x")
849+
elseif(CMAKE_SYSTEM_PROCESSOR_LOWER STREQUAL "s390x")
850850
set(ARCH "s390x")
851-
elseif (${CMAKE_SYSTEM_PROCESSOR_LOWER} STREQUAL "loongarch64")
851+
elseif(CMAKE_SYSTEM_PROCESSOR_LOWER STREQUAL "loongarch64")
852852
set(ARCH "loongarch64")
853853
else()
854854
message(STATUS "Unknown processor found. Using generic implementations. Processor: " ${CMAKE_SYSTEM_PROCESSOR})
@@ -862,6 +862,8 @@ if(ARCH STREQUAL "x86" AND NOT OPENSSL_NO_SSE2_FOR_TESTING)
862862
# See: https://github.com/aws/aws-lc/commit/6fe8dcbe96e580ea85233fdb98a142e42951b70b
863863
if(GCC OR CLANG)
864864
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
865+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
866+
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -msse2")
865867
endif()
866868
endif()
867869

0 commit comments

Comments
 (0)