Changeset View
Changeset View
Standalone View
Standalone View
src/CMakeLists.txt
Show All 12 Lines | |||||
option(BUILD_BITCOIN_ZMQ "Activate the ZeroMQ functionalities" ON) | option(BUILD_BITCOIN_ZMQ "Activate the ZeroMQ functionalities" ON) | ||||
option(BUILD_BITCOIN_SEEDER "Build bitcoin-seeder" ON) | option(BUILD_BITCOIN_SEEDER "Build bitcoin-seeder" ON) | ||||
option(BUILD_BITCOIN_CLI "Build bitcoin-cli" ON) | option(BUILD_BITCOIN_CLI "Build bitcoin-cli" ON) | ||||
option(BUILD_BITCOIN_TX "Build bitcoin-tx" ON) | option(BUILD_BITCOIN_TX "Build bitcoin-tx" ON) | ||||
option(BUILD_BITCOIN_QT "Build bitcoin-qt" ON) | option(BUILD_BITCOIN_QT "Build bitcoin-qt" ON) | ||||
option(ENABLE_HARDENING "Harden the executables" ON) | option(ENABLE_HARDENING "Harden the executables" ON) | ||||
option(ENABLE_REDUCE_EXPORTS "Reduce the amount of exported symbols" OFF) | option(ENABLE_REDUCE_EXPORTS "Reduce the amount of exported symbols" OFF) | ||||
option(ENABLE_STATIC_LIBSTDCXX "Statically link libstdc++" OFF) | option(ENABLE_STATIC_LIBSTDCXX "Statically link libstdc++" OFF) | ||||
option(ENABLE_GLIBC_BACK_COMPAT "Enable Glibc compatibility features" OFF) | |||||
# Allow usage of sanitizers by setting ECM_ENABLE_SANITIZERS | # Allow usage of sanitizers by setting ECM_ENABLE_SANITIZERS | ||||
if(ENABLE_SANITIZERS) | if(ENABLE_SANITIZERS) | ||||
set(ECM_ENABLE_SANITIZERS ${ENABLE_SANITIZERS}) | set(ECM_ENABLE_SANITIZERS ${ENABLE_SANITIZERS}) | ||||
find_package(ECM NO_MODULE) | find_package(ECM NO_MODULE) | ||||
if(ECM_MODULE_PATH) | if(ECM_MODULE_PATH) | ||||
list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) | list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) | ||||
include(ECMEnableSanitizers) | include(ECMEnableSanitizers) | ||||
▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | |||||
target_compile_definitions(util PUBLIC HAVE_CONFIG_H) | target_compile_definitions(util PUBLIC HAVE_CONFIG_H) | ||||
target_include_directories(util | target_include_directories(util | ||||
PUBLIC | PUBLIC | ||||
. | . | ||||
# To access the config. | # To access the config. | ||||
${CMAKE_CURRENT_BINARY_DIR} | ${CMAKE_CURRENT_BINARY_DIR} | ||||
) | ) | ||||
if(ENABLE_GLIBC_BACK_COMPAT) | |||||
# glibc absorbed clock_gettime in 2.17. librt (its previous location) is | |||||
# safe to link in anyway for back-compat. | |||||
find_library(RT_LIBRARY rt) | |||||
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 | |||||
add_linker_flag(-Wl,--wrap=__divmoddi4) | |||||
add_linker_flag(-Wl,--wrap=log2f) | |||||
target_sources(util PRIVATE compat/glibc_compat.cpp) | |||||
endif() | |||||
# Target specific configs | # Target specific configs | ||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | ||||
set(Boost_USE_STATIC_LIBS ON) | set(Boost_USE_STATIC_LIBS ON) | ||||
set(Boost_THREADAPI win32) | set(Boost_THREADAPI win32) | ||||
find_package(SHLWAPI REQUIRED) | find_package(SHLWAPI REQUIRED) | ||||
target_link_libraries(util ${SHLWAPI_LIBRARY}) | target_link_libraries(util ${SHLWAPI_LIBRARY}) | ||||
target_include_directories(util PUBLIC ${SHLWAPI_INCLUDE_DIR}) | target_include_directories(util PUBLIC ${SHLWAPI_INCLUDE_DIR}) | ||||
▲ Show 20 Lines • Show All 194 Lines • Show Last 20 Lines |