diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-01-08 16:40:02 -0800 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-01-08 16:40:02 -0800 |
commit | 2a996f492f933a6b7c27117904fecc447d0c2dc1 (patch) | |
tree | 2ee0ebfd45b1c35fd16f037693406bb7d0fa93e7 /CMakeLists.txt | |
parent | Merge pull request #1509 (diff) | |
parent | Build wallet with Android NDK (diff) | |
download | monero-2a996f492f933a6b7c27117904fecc447d0c2dc1.tar.xz |
Merge pull request #1510
80abc3bc Build wallet with Android NDK (MoroccanMalinois)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e6e4afb62..e42cdb384 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -378,6 +378,13 @@ else() set(STATIC_ASSERT_FLAG "-Dstatic_assert=_Static_assert") endif() + try_compile(STATIC_ASSERT_CPP_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-static-assert.cpp" COMPILE_DEFINITIONS "-std=c++11") + if(STATIC_ASSERT_CPP_RES) + set(STATIC_ASSERT_CPP_FLAG "") + else() + set(STATIC_ASSERT_CPP_FLAG "-Dstatic_assert=_Static_assert") + endif() + option(COVERAGE "Enable profiling for test coverage report" 0) if(COVERAGE) @@ -413,7 +420,7 @@ else() 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}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG}") + 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}") # With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that # is fixed in the code (Issue #847), force compiler to be conservative. @@ -497,6 +504,13 @@ else() endif(ARM) + if(ANDROID AND NOT BUILD_GUI_DEPS STREQUAL "ON") + #From Android 5: "only position independent executables (PIE) are supported" + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -fPIE -pie") + endif() + if(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_HAS_TR1_TUPLE=0") endif() @@ -583,7 +597,7 @@ endif() include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) if(MINGW) set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi) -elseif(APPLE OR FREEBSD OR OPENBSD) +elseif(APPLE OR FREEBSD OR OPENBSD OR ANDROID) set(EXTRA_LIBRARIES "") elseif(DRAGONFLY) find_library(COMPAT compat) |