CMakeLists.txt: Run cppcheck in dev scenarios when available

This commit is contained in:
alex-thiessen-for-siemens 2023-12-19 14:32:44 +01:00 committed by GitHub
parent 47ccde8bf1
commit 516f588c0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,14 @@ cmake_dependent_option(YAML_MSVC_SHARED_RT
"CMAKE_SYSTEM_NAME MATCHES Windows" OFF)
set(YAML_CPP_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/yaml-cpp"
CACHE STRING "Path to install the CMake package to")
if (YAML_CPP_BUILD_TESTS && CMAKE_VERSION VERSION_GREATER_EQUAL "3.10")
find_program(CMAKE_CXX_CPPCHECK NAMES cppcheck)
if (CMAKE_CXX_CPPCHECK)
option(YAML_CPP_CHECK "Run cppcheck static code analysis" ON)
endif()
endif()
if (YAML_CPP_FORMAT_SOURCE)
find_program(YAML_CPP_CLANG_FORMAT_EXE NAMES clang-format)
endif()