@@ -13,7 +13,7 @@ if (CMAKE_CROSSCOMPILING)
13
13
endif ()
14
14
15
15
if (APPLE AND NOT BIGNUM_NO)
16
- find_program (" brew" brew)
16
+ find_program (brew " brew" )
17
17
if (NOT brew STREQUAL "" )
18
18
# These Homebrew packages may be keg-only, meaning that they won't be found
19
19
# in expected paths because they may conflict with system files. Ask
@@ -29,7 +29,7 @@ if (APPLE AND NOT BIGNUM_NO)
29
29
set (GMP_LIBS "-L${gmp_prefix} /lib -lgmp" )
30
30
endif ()
31
31
else ()
32
- find_program (" port" port)
32
+ find_program (port " port" )
33
33
# if homebrew isn't installed and macports is, add the macports default paths
34
34
# as a last resort.
35
35
if (NOT port STREQUAL "" )
@@ -101,7 +101,16 @@ if (COVERAGE)
101
101
set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} --coverage" )
102
102
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" )
103
103
else ()
104
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3" )
104
+ check_c_compiler_flag("-O3" OPTIMIZE_O3)
105
+ if (OPTIMIZE_O3)
106
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3" )
107
+ else ()
108
+ # MSVC
109
+ check_c_compiler_flag("/Ox" OPTIMIZE_OX)
110
+ if (OPTIMIZE_OX)
111
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Ox" )
112
+ endif ()
113
+ endif ()
105
114
endif ()
106
115
107
116
set (PRECOMP ${ECMULT_STATIC_PRECOMPUTATION} )
@@ -110,7 +119,7 @@ if (NOT ASM_ARM)
110
119
check_c_source_compiles("\
111
120
#include <stdint.h> \n\
112
121
uint64_t a = 11, tmp; \n\
113
- int main(void) {__asm__ __volatile__(\" movq 0x100000000,%1; mulq %%rsi\" : \" +a\" (a) : \" S\" (tmp) : \" cc\" , \" %rdx\" );return 0;}" ASM_64BIT)
122
+ int main(void) {__asm__ __volatile__(\" movq $ 0x100000000,%1; mulq %%rsi\" : \" +a\" (a) : \" S\" (tmp) : \" cc\" , \" %rdx\" );return 0;}" ASM_64BIT)
114
123
if (ASM_64BIT)
115
124
set (ASM_x86_64 ON )
116
125
elseif (ASM_x86_64)
@@ -163,9 +172,7 @@ if (ASM_x86_64)
163
172
# Define this symbol to enable x86_64 assembly optimizations
164
173
add_compile_definitions (USE_ASM_X86_64=1)
165
174
else ()
166
- if (ASM_ARM)
167
- set (USE_EXTERNAL_ASM ON )
168
- endif ()
175
+ set (USE_EXTERNAL_ASM ${ASM_ARM} )
169
176
# no asm
170
177
endif ()
171
178
0 commit comments