Skip to content

Commit

Permalink
[👷][#15] CMake : follow a cmake-utils refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaslepoix authored and Dauliac committed Nov 23, 2021
1 parent 52d7cd3 commit d13ac50
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 28 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ add_subdirectory( "${CMAKE_SOURCE_DIR}/src" )
add_subdirectory( "${CMAKE_SOURCE_DIR}/test" )

coverage_global()
static_analysis_codechecker(
codechecker(
GLOBAL
NO_CTU
SKIP
+${CMAKE_SOURCE_DIR}/src
+${CMAKE_SOURCE_DIR}/test/unit
-*
ARGS
"${CMAKE_BINARY_DIR}/compile_commands.json"
Expand Down
56 changes: 36 additions & 20 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,46 @@ target_include_directories(

file(GLOB_RECURSE RAISIN_HEADERS "*.hpp")

static_analysis_lizard(
TARGET
raisin
ADDITIONAL_FILES
${RAISIN_HEADERS}
ARGS
--languages
cpp
--sort
cyclomatic_complexity)
lizard(
TARGET raisin
ADDITIONAL_FILES
${RAISIN_HEADERS}
ARGS
--languages cpp
--sort cyclomatic_complexity
)

static_analysis_iwyu(
TARGET raisin ARGS --std=c++17 # Useless with -p ?
# -p="${CMAKE_BINARY_DIR}" # Outdated iwyu version.
-Xiwyu --no_comments)
iwyu(
TARGET raisin
ARGS
--std=c++17 # Useless with -p ?
# -p="${CMAKE_BINARY_DIR}" # Outdated iwyu version.
-Xiwyu
--no_comments
)

static_analysis_tidy(TARGET raisin ARGS -p="${CMAKE_BINARY_DIR}" -checks=*)
clang_tidy(
TARGET raisin
ARGS
-p="${CMAKE_BINARY_DIR}"
-checks=*
)

static_analysis_format(TARGET raisin ADDITIONAL_FILES ${RAISIN_HEADERS} ARGS)
clang_format(
TARGET raisin
ADDITIONAL_FILES
${RAISIN_HEADERS}
ARGS
)

static_analysis_cppcheck(
TARGET raisin ADDITIONAL_FILES ${RAISIN_HEADERS} ARGS
# --enable=all
-v)
cppcheck(
TARGET raisin
ADDITIONAL_FILES
${RAISIN_HEADERS}
ARGS
# --enable=all
-v
)

enable_clang_build_analyzer(TARGET raisin)

Expand Down
22 changes: 15 additions & 7 deletions test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ if(Catch2_FOUND)

coverage(TARGET_TO_RUN raisin_unittest TARGETS_TO_COVER raisin)

static_analysis_iwyu(
TARGET raisin_unittest ARGS --std=c++17 # Useless with -p ?
# -p="${CMAKE_BINARY_DIR}" # Outdated iwyu version.
-Xiwyu --no_comments)

static_analysis_format(TARGET raisin_unittest ADDITIONAL_FILES
${RAISIN_UNITTEST_HEADERS} ARGS)
iwyu(
TARGET raisin_unittest
ARGS
--std=c++17 # Useless with -p ?
# -p="${CMAKE_BINARY_DIR}" # Outdated iwyu version.
-Xiwyu
--no_comments
)

clang_format(
TARGET raisin_unittest
ADDITIONAL_FILES
${RAISIN_UNITTEST_HEADERS}
ARGS
)

enable_clang_build_analyzer(TARGET raisin_unittest)

Expand Down

0 comments on commit d13ac50

Please sign in to comment.