mdbx-cmake: add workaround for LTO on Android (https://reviews.llvm.org/D79919).

This commit is contained in:
Leonid Yuriev 2022-01-05 17:36:50 +03:00
parent 066bb696e3
commit 489f7a3136

View File

@ -442,14 +442,19 @@ if(CMAKE_COMPILER_IS_CLANG)
unset(clang_search_dirs) unset(clang_search_dirs)
endif() endif()
if (CMAKE_CLANG_AR AND CMAKE_CLANG_NM AND CMAKE_CLANG_RANLIB if(CMAKE_CLANG_AR AND CMAKE_CLANG_NM AND CMAKE_CLANG_RANLIB
AND ((CLANG_LTO_PLUGIN AND CMAKE_LD_GOLD) AND ((CLANG_LTO_PLUGIN AND CMAKE_LD_GOLD)
OR (CMAKE_CLANG_LD OR (CMAKE_CLANG_LD
AND NOT (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND NOT (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux"
AND CMAKE_SYSTEM_NAME STREQUAL "Linux")) AND CMAKE_SYSTEM_NAME STREQUAL "Linux"))
OR APPLE)) OR APPLE))
set(CLANG_LTO_AVAILABLE TRUE) if(ANDROID AND CMAKE_SYSTEM_VERSION VERSION_LESS 22)
message(STATUS "Link-Time Optimization by CLANG/LLVM is available") set(CLANG_LTO_AVAILABLE FALSE)
message(STATUS "Link-Time Optimization by CLANG/LLVM is available but unusable due https://reviews.llvm.org/D79919")
else()
set(CLANG_LTO_AVAILABLE TRUE)
message(STATUS "Link-Time Optimization by CLANG/LLVM is available")
endif()
elseif(CMAKE_TOOLCHAIN_FILE AND NOT CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_VERSION VERSION_LESS 7.0) elseif(CMAKE_TOOLCHAIN_FILE AND NOT CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_VERSION VERSION_LESS 7.0)
set(CLANG_LTO_AVAILABLE TRUE) set(CLANG_LTO_AVAILABLE TRUE)
if(NOT CMAKE_CLANG_LD) if(NOT CMAKE_CLANG_LD)