libevent/cmake/AddLinkerFlags.cmake
Azat Khuzhin f01879d5a6 Align ELF sections to 16K boundaries (-Wl,-z,max-page-size=16384)
Even though the initial request was about Android, it is not only about
it, but it could be the case for Linux as well (so as Apple M1/...
chips)

And this should not affect anything, since this is just ELFs

Fixes: https://github.com/libevent/libevent/issues/1708
2024-10-29 11:41:26 +03:00

15 lines
416 B
CMake

include(CheckLinkerFlag)
macro(add_linker_flags)
foreach(flag ${ARGN})
string(REGEX REPLACE "[-.+/:= ]" "_" _flag_esc "${flag}")
check_linker_flag(C "${flag}" check_c_linker_flag_${_flag_esc})
if (check_c_linker_flag_${_flag_esc})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${flag}")
endif()
endforeach()
endmacro()