Changeset View
Changeset View
Standalone View
Standalone View
CMakeLists.txt
Show All 25 Lines | |||||
# Make contrib script accessible. | # Make contrib script accessible. | ||||
set(CONTRIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/contrib) | set(CONTRIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/contrib) | ||||
# Default to RelWithDebInfo configuration | # Default to RelWithDebInfo configuration | ||||
if(NOT CMAKE_BUILD_TYPE) | if(NOT CMAKE_BUILD_TYPE) | ||||
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING | set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING | ||||
"Select the configuration for the build" FORCE) | "Select the configuration for the build" FORCE) | ||||
set(__NO_USER_CMAKE_BUILD_TYPE ON CACHE BOOL "True if the user didn't set a build type on the command line") | |||||
endif() | endif() | ||||
# Find the python interpreter. This is required for several targets. | # Find the python interpreter. This is required for several targets. | ||||
find_package(Python 3.5 COMPONENTS Interpreter REQUIRED) | find_package(Python 3.5 COMPONENTS Interpreter REQUIRED) | ||||
# Add the magic targets `check-*` | # Add the magic targets `check-*` | ||||
add_custom_target(check-all) | add_custom_target(check-all) | ||||
add_custom_target(check) | add_custom_target(check) | ||||
Show All 19 Lines | exclude_from_source_package( | ||||
"arcanist/" | "arcanist/" | ||||
"depends/" | "depends/" | ||||
# Files | # Files | ||||
"[^.]+[.]md$" | "[^.]+[.]md$" | ||||
"Dockerfile-doxygen" | "Dockerfile-doxygen" | ||||
) | ) | ||||
option(ENABLE_COVERAGE "Enable coverage" OFF) | |||||
option(ENABLE_BRANCH_COVERAGE "Enable branch coverage" OFF) | |||||
if(ENABLE_COVERAGE) | |||||
include(Coverage) | |||||
enable_coverage(${ENABLE_BRANCH_COVERAGE}) | |||||
include(AddCompilerFlags) | |||||
# If no build type is manually defined, override the optimization level. | |||||
# Otherwise, alert the user than the coverage result might be useless. | |||||
if(__NO_USER_CMAKE_BUILD_TYPE) | |||||
set_c_optimization_level(0) | |||||
# Setting -Og instead of -O0 is a workaround for the GCC bug 90380: | |||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90380 | |||||
# | |||||
# This bug is fixed upstream, but is not widely distributed yet. | |||||
# Fixed in GCC versions: | |||||
# - GCC 7.x: versions <= 7.2 are unaffected | |||||
# - GCC 8.x: versions >= 8.3.1 | |||||
# - GCC 9.x: versions >= 9.1.1 | |||||
# - GCC 10.x: all versions | |||||
set_cxx_optimization_level(g) | |||||
else() | |||||
message(WARNING "It is advised to not enforce CMAKE_BUILD_TYPE to get the best coverage results") | |||||
endif() | |||||
exclude_from_coverage( | |||||
"depends" | |||||
"src/bench" | |||||
"src/crypto/ctaes" | |||||
"src/leveldb" | |||||
"src/univalue" | |||||
) | |||||
add_custom_target_coverage(check) | |||||
add_custom_target_coverage(check-all) | |||||
add_custom_target_coverage(check-extended) | |||||
add_custom_target_coverage(check-upgrade-activated) | |||||
add_custom_target_coverage(check-upgrade-activated-extended) | |||||
endif() | |||||
add_subdirectory(src) | add_subdirectory(src) | ||||
add_subdirectory(test) | add_subdirectory(test) | ||||
add_subdirectory(contrib) | add_subdirectory(contrib) | ||||
add_subdirectory(doc) | add_subdirectory(doc) | ||||
include(PackageOptions.cmake) | include(PackageOptions.cmake) |