diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b0978b..8114ae9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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()