diff --git a/CMakeLists.txt b/CMakeLists.txt index 11dc3f6e53..7260b0f868 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,25 +90,21 @@ mark_as_advanced(FORCE SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY) set(SECP256K1_ASM "AUTO" CACHE STRING "Assembly to use: \"AUTO\", \"OFF\", \"x86_64\" or \"arm32\" (experimental). [default=AUTO]") set_property(CACHE SECP256K1_ASM PROPERTY STRINGS "AUTO" "OFF" "x86_64" "arm32") check_string_option_value(SECP256K1_ASM) -if(SECP256K1_ASM STREQUAL "arm32") +if(NOT SECP256K1_ASM STREQUAL "OFF") enable_language(ASM) + include(CheckX86_64Assembly) include(CheckArm32Assembly) + check_x86_64_assembly() check_arm32_assembly() - if(HAVE_ARM32_ASM) - add_compile_definitions(USE_EXTERNAL_ASM=1) - else() + if(SECP256K1_ASM STREQUAL "arm32" AND NOT HAVE_ARM32_ASM) message(FATAL_ERROR "ARM32 assembly requested but not available.") + elseif(SECP256K1_ASM STREQUAL "x86_64" AND NOT HAVE_X86_64_ASM) + message(FATAL_ERROR "x86_64 assembly requested but not available.") endif() -elseif(SECP256K1_ASM) - include(CheckX86_64Assembly) - check_x86_64_assembly() if(HAVE_X86_64_ASM) - set(SECP256K1_ASM "x86_64") add_compile_definitions(USE_ASM_X86_64=1) - elseif(SECP256K1_ASM STREQUAL "AUTO") - set(SECP256K1_ASM "OFF") - else() - message(FATAL_ERROR "x86_64 assembly requested but not available.") + elseif(HAVE_ARM32_ASM) + add_compile_definitions(USE_EXTERNAL_ASM=1) endif() endif()