Skip to content

Commit

Permalink
Merge pull request #8 from lefticus/disable_troublesome_cppcheck_error
Browse files Browse the repository at this point in the history
Override cppcheck flags to disable performance copy check
  • Loading branch information
lefticus authored Feb 10, 2022
2 parents 78b075c + c4bfaf6 commit 83e67f4
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
# Add project_options v0.13.1
# https://github.com/cpp-best-practices/project_options
include(FetchContent)
FetchContent_Declare(_project_options
URL https://github.com/cpp-best-practices/project_options/archive/refs/heads/main.zip)
FetchContent_Declare(
_project_options
URL https://github.com/lefticus/project_options/archive/refs/heads/make_cppcheck_flags_configurable.zip)
# URL https://github.com/cpp-best-practices/project_options/archive/refs/tags/v0.13.1.zip)
FetchContent_MakeAvailable(_project_options)
include(${_project_options_SOURCE_DIR}/Index.cmake)
Expand All @@ -30,8 +31,14 @@ include(${_project_options_SOURCE_DIR}/Index.cmake)
# # Setup vcpkg - should be called before defining project()
# run_vcpkg()

set(GIT_SHA "Unknown" CACHE STRING "SHA this build was generated from")
string(SUBSTRING "${GIT_SHA}" 0 8 GIT_SHORT_SHA)
set(GIT_SHA
"Unknown"
CACHE STRING "SHA this build was generated from")
string(
SUBSTRING "${GIT_SHA}"
0
8
GIT_SHORT_SHA)

# Set the project name and language
project(
Expand Down Expand Up @@ -77,7 +84,15 @@ dynamic_project_options(
# MSVC_WARNINGS # Override the defaults for the MSVC warnings
# CLANG_WARNINGS # Override the defaults for the CLANG warnings
# GCC_WARNINGS # Override the defaults for the GCC warnings
)
CPPCHECK_OPTIONS
--enable=style,performance,warning,portability
--inline-suppr
# We cannot act on a bug/missing feature of cppcheck
--suppress=internalAstError
# if a file does not have an internalAstError, we get an unmatchedSuppression error
--suppress=unmatchedSuppression
--suppress=passedByValue
--inconclusive)

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

set(CPACK_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${GIT_SHORT_SHA}-${CMAKE_SYSTEM_NAME}-${CMAKE_BUILD_TYPE}-${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}")
"${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${GIT_SHORT_SHA}-${CMAKE_SYSTEM_NAME}-${CMAKE_BUILD_TYPE}-${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}"
)

include(CPack)


0 comments on commit 83e67f4

Please sign in to comment.