Changeset View
Changeset View
Standalone View
Standalone View
src/CMakeLists.txt
Show First 20 Lines • Show All 262 Lines • ▼ Show 20 Lines | |||||
) | ) | ||||
if(ENABLE_GLIBC_BACK_COMPAT) | if(ENABLE_GLIBC_BACK_COMPAT) | ||||
# glibc absorbed clock_gettime in 2.17. librt (its previous location) is | # glibc absorbed clock_gettime in 2.17. librt (its previous location) is | ||||
# safe to link in anyway for back-compat. | # safe to link in anyway for back-compat. | ||||
find_library(RT_LIBRARY rt) | find_library(RT_LIBRARY rt) | ||||
target_link_libraries(util ${RT_LIBRARY}) | target_link_libraries(util ${RT_LIBRARY}) | ||||
#__fdelt_chk's params and return type have changed from long unsigned int to | |||||
# long int. See which one is present here. | |||||
include(CheckPrototypeDefinition) | |||||
set(CMAKE_REQUIRED_DEFINITIONS -D_FORTIFY_SOURCE=2) | |||||
# Without some optimization the compiler won't detect the prototype conflict | |||||
# and always succeed to build. | |||||
set(CMAKE_REQUIRED_FLAGS -O2) | |||||
check_prototype_definition( | |||||
__fdelt_warn | |||||
"extern long unsigned int __fdelt_warn(long unsigned int a)" | |||||
"0" | |||||
"sys/select.h" | |||||
FDELT_PROTOTYPE_LONG_UNSIGNED_INT | |||||
) | |||||
if(FDELT_PROTOTYPE_LONG_UNSIGNED_INT) | |||||
set(FDELT_TYPE "long unsigned int") | |||||
else() | |||||
set(FDELT_TYPE "long int") | |||||
endif() | |||||
target_compile_definitions(util PRIVATE "-DFDELT_TYPE=${FDELT_TYPE}") | |||||
# Wrap some glibc functions with ours | # Wrap some glibc functions with ours | ||||
add_linker_flags(-Wl,--wrap=__divmoddi4) | add_linker_flags(-Wl,--wrap=__divmoddi4) | ||||
add_linker_flags(-Wl,--wrap=log2f) | add_linker_flags(-Wl,--wrap=log2f) | ||||
if(NOT HAVE_LARGE_FILE_SUPPORT) | if(NOT HAVE_LARGE_FILE_SUPPORT) | ||||
add_linker_flags(-Wl,--wrap=fcntl -Wl,--wrap=fcntl64) | add_linker_flags(-Wl,--wrap=fcntl -Wl,--wrap=fcntl64) | ||||
endif() | endif() | ||||
▲ Show 20 Lines • Show All 269 Lines • Show Last 20 Lines |