Changeset View
Changeset View
Standalone View
Standalone View
src/CMakeLists.txt
Show All 20 Lines | |||||
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) | option(ENABLE_GLIBC_BACK_COMPAT "Enable Glibc compatibility features" OFF) | ||||
option(ENABLE_QRCODE "Enable QR code display" ON) | option(ENABLE_QRCODE "Enable QR code display" ON) | ||||
option(ENABLE_UPNP "Enable UPnP support" ON) | option(ENABLE_UPNP "Enable UPnP support" ON) | ||||
option(ENABLE_NOTIFICATIONS "Enable desktop notifications" ON) | option(ENABLE_NOTIFICATIONS "Enable desktop notifications" ON) | ||||
option(ENABLE_WERROR "Promote some compiler warnings to errors" OFF) | option(ENABLE_WERROR "Promote some compiler warnings to errors" OFF) | ||||
option(START_WITH_UPNP "Make UPnP the default to map ports" OFF) | option(START_WITH_UPNP "Make UPnP the default to map ports" OFF) | ||||
option(ENABLE_CLANG_TIDY "Enable clang-tidy checks for Bitcoin ABC" OFF) | option(ENABLE_CLANG_TIDY "Enable clang-tidy checks for Bitcoin ABC" OFF) | ||||
option(ENABLE_PROFILING "Select the profiling tool to use" OFF) | |||||
# If ccache is available, then use it. | # If ccache is available, then use it. | ||||
find_program(CCACHE ccache) | find_program(CCACHE ccache) | ||||
if(CCACHE) | if(CCACHE) | ||||
message(STATUS "Using ccache: ${CCACHE}") | message(STATUS "Using ccache: ${CCACHE}") | ||||
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE}) | set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE}) | ||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE}) | set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE}) | ||||
endif(CCACHE) | endif(CCACHE) | ||||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | if(ENABLE_HARDENING) | ||||
endif() | endif() | ||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | ||||
# MinGw provides its own libssp for stack smashing protection | # MinGw provides its own libssp for stack smashing protection | ||||
link_libraries(ssp) | link_libraries(ssp) | ||||
endif() | endif() | ||||
endif() | endif() | ||||
if(ENABLE_PROFILING MATCHES "gprof") | |||||
message(STATUS "Enable profiling with gprof") | |||||
# -pg is incompatible with -pie. Since hardening and profiling together | |||||
# doesn't make sense, we simply make them mutually exclusive here. | |||||
# Additionally, hardened toolchains may force -pie by default, in which | |||||
# case it needs to be turned off with -no-pie. | |||||
if(ENABLE_HARDENING) | |||||
message(FATAL_ERROR "Profiling with gprof requires disabling hardening with -DENABLE_HARDENING=OFF.") | |||||
endif() | |||||
add_linker_flags(-no-pie) | |||||
add_compiler_flags(-pg) | |||||
add_linker_flags(-pg) | |||||
endif() | |||||
# Enable warning | # Enable warning | ||||
add_c_compiler_flags(-Wnested-externs -Wstrict-prototypes) | add_c_compiler_flags(-Wnested-externs -Wstrict-prototypes) | ||||
add_compiler_flags( | add_compiler_flags( | ||||
-Wall | -Wall | ||||
-Wextra | -Wextra | ||||
-Wformat | -Wformat | ||||
-Wvla | -Wvla | ||||
-Wformat-security | -Wformat-security | ||||
▲ Show 20 Lines • Show All 424 Lines • Show Last 20 Lines |