CMAKE: moved GNA var setting to proper place; removed find_package when build python...
[platform/upstream/dldt.git] / inference-engine / cmake / cpplint_run.cmake
1 # Copyright (C) 2018-2019 Intel Corporation
2 # SPDX-License-Identifier: Apache-2.0
3 #
4
5 file(REMOVE "${OUTPUT_FILE}")
6
7 execute_process(
8     COMMAND
9         "${PYTHON_EXECUTABLE}"
10         "${CPPLINT_SCRIPT}"
11         "--linelength=160"
12         "--counting=detailed"
13         "--filter=-readability/fn_size"
14         "${INPUT_FILE}"
15     WORKING_DIRECTORY "${WORKING_DIRECTORY}"
16     RESULT_VARIABLE result
17     OUTPUT_VARIABLE output
18     ERROR_VARIABLE output)
19
20 # Display the cpplint output to console (to parse it form IDE)
21 message("${output}")
22
23 # Store cpplint output to file (replace problematic symbols)
24 string(REPLACE "\"" "&quot\;" output "${output}")
25 string(REPLACE "<" "&lt\;" output "${output}")
26 string(REPLACE ">" "&gt\;" output "${output}")
27 string(REPLACE "'" "&apos\;" output "${output}")
28 string(REPLACE "&" "&amp\;" output "${output}")
29 file(WRITE "${OUTPUT_FILE}" "${output}")
30
31 if(NOT SKIP_RETURN_CODE)
32     # Pass through the cpplint return code
33     if(NOT result EQUAL 0)
34         message(FATAL_ERROR "[cpplint] Code style check failed for : ${INPUT_FILE}")
35     endif()
36 endif()