-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathCMakeLists.txt
25 lines (19 loc) · 1000 Bytes
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
cmake_minimum_required(VERSION 3.5)
project(pvs-studio-cmake-example-9 CXX)
set(SOURCE_TREE_ROOT ${CMAKE_SOURCE_DIR})
file(TO_NATIVE_PATH ${SOURCE_TREE_ROOT} SOURCE_TREE_ROOT)
set(PVS_STUDIO_CONFIG "${CMAKE_BINARY_DIR}/PVS-Studio.cfg")
set(PVS_STUDIO_CONFIG_COMMAND "${CMAKE_COMMAND}" -E echo "sourcetree-root=${SOURCE_TREE_ROOT}" > "${PVS_STUDIO_CONFIG}")
add_custom_command(OUTPUT "${PVS_STUDIO_CONFIG}"
COMMAND ${PVS_STUDIO_CONFIG_COMMAND}
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Generating PVS-Studio.cfg")
add_library(lib lib.cpp)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} lib)
include(../pvs-studio-cmake-module/PVS-Studio.cmake)
pvs_studio_add_target(TARGET example9.analyze ALL
OUTPUT FORMAT json
ANALYZE ${PROJECT_NAME} lib
CONFIG ${PVS_STUDIO_CONFIG}
DEPENDS ${PVS_STUDIO_CONFIG})