build: IWYU support added

This commit is contained in:
Mateusz Pusz
2021-03-30 13:15:47 +02:00
parent 5251a8a241
commit 01935996e6
8 changed files with 194 additions and 15 deletions

View File

@@ -34,9 +34,23 @@ set_warnings()
# set all contracts checking in a Debug build
add_compile_definitions($<$<CONFIG:Debug>:gsl_CONFIG_CONTRACT_CHECKING_AUDIT>)
# enable static analysis
# enable include-what-you-use
option(UNITS_IWYU "Enables include-what-you-use" OFF)
if(UNITS_IWYU)
include(include-what-you-use)
set_iwyu(
MAPPING_FILE "${PROJECT_SOURCE_DIR}/.mp-units.imp"
NO_FORWARD_DECLARATIONS
QUOTED_INCLUDES_FIRST
MAX_LINE_LENGTH 120
NO_COMMENTS
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(UNITS_AS_SYSTEM_HEADERS ON)
endif()
endif()
#enable_clang_tidy()
#enable_iwyu()
# add project code
add_subdirectory(src)