aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-09-29 22:16:19 +0200
committerRiccardo Spagni <ric@spagni.net>2018-09-29 22:20:31 +0200
commit4e3bff92ab4517d7eaa8a03fb1731283ce231342 (patch)
treea5ff642988f625f0f3562ad0c5ed0ac309f58df2 /CMakeLists.txt
parentMerge pull request #4456 (diff)
downloadmonero-4e3bff92ab4517d7eaa8a03fb1731283ce231342.tar.xz
Merge pull request #4457
85318e78 build: set ARCH_FLAG before compiler/linker flag checks (xiphon)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt68
1 files changed, 36 insertions, 32 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc0ecb14b..c31c14350 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -529,6 +529,40 @@ else()
endif()
endif()
endif()
+
+ option(NO_AES "Explicitly disable AES support" ${NO_AES})
+
+ if(NO_AES)
+ message(STATUS "AES support explicitly disabled")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_AES")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_AES")
+ elseif(NOT ARM AND NOT PPC64LE AND NOT PPC64 AND NOT PPC AND NOT S390X)
+ message(STATUS "AES support enabled")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
+ elseif(PPC64LE OR PPC64 OR PPC)
+ message(STATUS "AES support not available on POWER")
+ elseif(S390X)
+ message(STATUS "AES support not available on s390x")
+ elseif(ARM6)
+ message(STATUS "AES support not available on ARMv6")
+ elseif(ARM7)
+ message(STATUS "AES support not available on ARMv7")
+ elseif(ARM8)
+ CHECK_CXX_ACCEPTS_FLAG("-march=${ARCH}+crypto" ARCH_PLUS_CRYPTO)
+ if(ARCH_PLUS_CRYPTO)
+ message(STATUS "Crypto extensions enabled for ARMv8")
+ set(ARCH_FLAG "-march=${ARCH}+crypto")
+ else()
+ message(STATUS "Crypto extensions unavailable on your ARMv8 device")
+ endif()
+ else()
+ message(STATUS "AES support disabled")
+ endif()
+
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_FLAG}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_FLAG}")
+
set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized")
if(NOT MINGW)
set(WARNINGS_AS_ERRORS_FLAG "-Werror")
@@ -639,38 +673,8 @@ else()
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
- option(NO_AES "Explicitly disable AES support" ${NO_AES})
-
- if(NO_AES)
- message(STATUS "AES support explicitly disabled")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_AES")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_AES")
- elseif(NOT ARM AND NOT PPC64LE AND NOT PPC64 AND NOT PPC AND NOT S390X)
- message(STATUS "AES support enabled")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
- elseif(PPC64LE OR PPC64 OR PPC)
- message(STATUS "AES support not available on POWER")
- elseif(S390X)
- message(STATUS "AES support not available on s390x")
- elseif(ARM6)
- message(STATUS "AES support not available on ARMv6")
- elseif(ARM7)
- message(STATUS "AES support not available on ARMv7")
- elseif(ARM8)
- CHECK_CXX_ACCEPTS_FLAG("-march=${ARCH}+crypto" ARCH_PLUS_CRYPTO)
- if(ARCH_PLUS_CRYPTO)
- message(STATUS "Crypto extensions enabled for ARMv8")
- set(ARCH_FLAG "-march=${ARCH}+crypto")
- else()
- message(STATUS "Crypto extensions unavailable on your ARMv8 device")
- endif()
- else()
- message(STATUS "AES support disabled")
- endif()
-
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG} ${C_SECURITY_FLAGS}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG} ${CXX_SECURITY_FLAGS}")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${COVERAGE_FLAGS} ${PIC_FLAG} ${C_SECURITY_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${COVERAGE_FLAGS} ${PIC_FLAG} ${CXX_SECURITY_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS}")
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that