Вынос опций за пределы функций

This commit is contained in:
Andrei Astafev 2019-10-09 09:12:42 +03:00
parent f76b9c6758
commit 6be68e5e51
3 changed files with 58 additions and 48 deletions

View File

@ -1,16 +1,19 @@
function(add_clang_analyze_check)
list(GET ARGN 0 _target)
set(_sources ${ARGN})
list(REMOVE_AT _sources 0)
option(CLANG_ANALYZE_FIX "Perform fixes for Clang-Check" OFF)
find_program(CLANG_CHECK_EXE
find_program(CLANG_CHECK_EXE
NAMES clang-check-10
clang-check-9
clang-check-8
clang-check-7
clang-check-6.0
clang-check)
if(CLANG_CHECK_EXE)
option(CLANG_ANALYZE_FIX "Perform fixes for Clang-Check" OFF)
endif()
function(add_clang_analyze_check)
list(GET ARGN 0 _target)
set(_sources ${ARGN})
list(REMOVE_AT _sources 0)
if(CLANG_CHECK_EXE)
if(CLANG_CHECK_FIX)
list(APPEND _args "-fix")

View File

@ -1,20 +1,23 @@
function(add_clang_tidy_check)
list(GET ARGN 0 _target)
set(_sources ${ARGN})
list(REMOVE_AT _sources 0)
option(CLANG_TIDY_FIX "Perform fixes for Clang-Tidy" OFF)
find_program(CLANG_TIDY_EXE
find_program(CLANG_TIDY_EXE
NAMES clang-tidy-10
clang-tidy-9
clang-tidy-8
clang-tidy-7
clang-tidy-6.0
clang-tidy)
if(CLANG_TIDY_EXE)
if(CLANG_TIDY_EXE)
option(CLANG_TIDY_FIX "Perform fixes for Clang-Tidy" OFF)
if(CLANG_TIDY_FIX)
list(APPEND _args "-fix")
endif()
endif()
function(add_clang_tidy_check)
list(GET ARGN 0 _target)
set(_sources ${ARGN})
list(REMOVE_AT _sources 0)
if(CLANG_TIDY_EXE)
if(NOT TARGET clang-tidy-check)
add_custom_target(clang-tidy-check)
endif()

View File

@ -1,9 +1,12 @@
option(ENABLE_CODE_COVERAGE "Enable code coverage support" OFF)
find_program(LCOV_EXE NAMES lcov)
find_program(GENHTML_EXE NAMES genhtml)
function(add_code_coverage)
list(GET ARGN 0 _target)
if(ENABLE_CODE_COVERAGE AND CMAKE_CXX_COMPILER_IS_GCC)
find_program(LCOV_EXE NAMES lcov)
find_program(GENHTML_EXE NAMES genhtml)
if(ENABLE_CODE_COVERAGE)
if(CMAKE_CXX_COMPILER_IS_GCC)
target_compile_options(${_target} PUBLIC "--coverage")
get_target_property(LF ${_target} LINK_FLAGS)
string(APPEND LF " --coverage")
@ -35,4 +38,5 @@ function(add_code_coverage)
else()
message("Only GCC is supported for code coverage")
endif()
endif()
endfunction()