diff options
Diffstat (limited to '')
-rw-r--r-- | CMakeLists.txt | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 87a53c368..3d325187d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -375,6 +375,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) @@ -410,7 +417,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. @@ -494,6 +501,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() @@ -580,7 +594,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) |