aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt29
1 files changed, 20 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e99e5a51..6b9c81895 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,7 +45,12 @@ function (die msg)
message(FATAL_ERROR "${BoldRed}${msg}${ColourReset}")
endfunction ()
-if (NOT ${ARCH} STREQUAL "")
+if ("${ARCH}" STREQUAL "" OR "${ARCH}" STREQUAL "native")
+ set(ARCH ${CMAKE_SYSTEM_PROCESSOR})
+ message(STATUS "Building natively on ${ARCH}")
+endif()
+
+if (NOT "${ARCH}" STREQUAL "")
string(SUBSTRING ${ARCH} 0 3 IS_ARM)
string(TOLOWER ${IS_ARM} IS_ARM)
@@ -323,7 +328,7 @@ else()
endif()
if(MINGW)
set(WARNINGS "${WARNINGS} -Wno-error=unused-value -Wno-error=unused-but-set-variable")
- set(MINGW_FLAG "${MINGW_FLAG} -DWIN32_LEAN_AND_MEAN -D_POSIX_C_SOURCE")
+ set(MINGW_FLAG "${MINGW_FLAG} -DWIN32_LEAN_AND_MEAN")
set(Boost_THREADAPI win32)
include_directories(SYSTEM src/platform/mingw)
# mingw doesn't support LTO (multiple definition errors at link time)
@@ -342,16 +347,19 @@ else()
set(STATIC_ASSERT_FLAG "-Dstatic_assert=_Static_assert")
endif()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG}")
+
option(NO_AES "Explicitly disable AES support" ${NO_AES})
- if (NO_AES)
- message(STATUS "Disabling AES support")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG}")
+ if(NOT NO_AES AND NOT (ARM6 OR ARM7))
+ message(STATUS "AES support enabled")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
+ elseif(ARM7 OR ARM6)
+ message(STATUS "AES support disabled (not available on ARM)")
else()
- message(STATUS "Enabling AES support")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} -maes")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} -maes")
+ message(STATUS "AES support disabled")
endif()
if(ARM6)
@@ -455,6 +463,9 @@ include(version.cmake)
add_subdirectory(contrib)
add_subdirectory(src)
+
+option(BUILD_TESTS "Build tests." OFF)
+
if(BUILD_TESTS)
add_subdirectory(tests)
endif()