Skip to content

Commit 83e67f4

Browse files
authored
Merge pull request #8 from lefticus/disable_troublesome_cppcheck_error
Override cppcheck flags to disable performance copy check
2 parents 78b075c + c4bfaf6 commit 83e67f4

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

CMakeLists.txt

+22-8
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
2020
# Add project_options v0.13.1
2121
# https://github.com/cpp-best-practices/project_options
2222
include(FetchContent)
23-
FetchContent_Declare(_project_options
24-
URL https://github.com/cpp-best-practices/project_options/archive/refs/heads/main.zip)
23+
FetchContent_Declare(
24+
_project_options
25+
URL https://github.com/lefticus/project_options/archive/refs/heads/make_cppcheck_flags_configurable.zip)
2526
# URL https://github.com/cpp-best-practices/project_options/archive/refs/tags/v0.13.1.zip)
2627
FetchContent_MakeAvailable(_project_options)
2728
include(${_project_options_SOURCE_DIR}/Index.cmake)
@@ -30,8 +31,14 @@ include(${_project_options_SOURCE_DIR}/Index.cmake)
3031
# # Setup vcpkg - should be called before defining project()
3132
# run_vcpkg()
3233

33-
set(GIT_SHA "Unknown" CACHE STRING "SHA this build was generated from")
34-
string(SUBSTRING "${GIT_SHA}" 0 8 GIT_SHORT_SHA)
34+
set(GIT_SHA
35+
"Unknown"
36+
CACHE STRING "SHA this build was generated from")
37+
string(
38+
SUBSTRING "${GIT_SHA}"
39+
0
40+
8
41+
GIT_SHORT_SHA)
3542

3643
# Set the project name and language
3744
project(
@@ -77,7 +84,15 @@ dynamic_project_options(
7784
# MSVC_WARNINGS # Override the defaults for the MSVC warnings
7885
# CLANG_WARNINGS # Override the defaults for the CLANG warnings
7986
# GCC_WARNINGS # Override the defaults for the GCC warnings
80-
)
87+
CPPCHECK_OPTIONS
88+
--enable=style,performance,warning,portability
89+
--inline-suppr
90+
# We cannot act on a bug/missing feature of cppcheck
91+
--suppress=internalAstError
92+
# if a file does not have an internalAstError, we get an unmatchedSuppression error
93+
--suppress=unmatchedSuppression
94+
--suppress=passedByValue
95+
--inconclusive)
8196

8297
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9")
8398
target_link_libraries(project_options INTERFACE stdc++fs)
@@ -116,8 +131,7 @@ endif()
116131
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT json2cpp)
117132

118133
set(CPACK_PACKAGE_FILE_NAME
119-
"${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${GIT_SHORT_SHA}-${CMAKE_SYSTEM_NAME}-${CMAKE_BUILD_TYPE}-${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}")
134+
"${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${GIT_SHORT_SHA}-${CMAKE_SYSTEM_NAME}-${CMAKE_BUILD_TYPE}-${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}"
135+
)
120136

121137
include(CPack)
122-
123-

0 commit comments

Comments
 (0)