sciqlop_code_analysis.cmake
44 lines
| 1.5 KiB
| text/x-cmake
|
CMakeLexer
/ cmake / sciqlop_code_analysis.cmake
r0 | # | |||
# sciqlop_code_analysis.cmake | ||||
mperrinel
|
r14 | # Launch code source analysis with CLANGANALYZER. Can be activated with the | ||
# ENABLE_ANALYSIS option. | ||||
r0 | # | |||
# The following CACHE variables are available: | ||||
mperrinel
|
r14 | # * CLANGANALYZER_EXTRA_ARGS: extra arguments for CLANGANALYZER; | ||
# * CLANGANALYZER_OUTPUT: path to the xml report of CLANGANALYZER. | ||||
r0 | # | |||
# The following variables are used (must be set by the cmake file calling this | ||||
# one): | ||||
# * ANALYSIS_INPUT_DIRS: directories to analyze; | ||||
# * ANALYSIS_EXCLUDE_DIRS: directories to exclude from the analysis. | ||||
# | ||||
# | ||||
mperrinel
|
r14 | # Analyze the source code with CLANGANALYZER | ||
r0 | # | |||
mperrinel
|
r14 | OPTION (ENABLE_ANALYSIS "Analyze the source code with clang_analyze" ON) | ||
IF (ENABLE_ANALYSIS) | ||||
r0 | ||||
mperrinel
|
r14 | # Make sure CLANGANALYZER has been found, otherwise the source code can't be | ||
r0 | # analyzed | |||
mperrinel
|
r14 | IF (CLANGANALYZER_FOUND) | ||
r0 | ||||
mperrinel
|
r14 | SET (CLANGANALYZER_OUTPUT "${CMAKE_BINARY_DIR}/clang-analyzer-ouput" | ||
CACHE STRING "Output file for the CLANGANALYZER report") | ||||
MARK_AS_ADVANCED (CLANGANALYZER_OUTPUT) | ||||
r0 | ||||
mperrinel
|
r14 | SET (CLANGANALYZER_EXTRA_ARGS -o ${CLANGANALYZER_OUTPUT} | ||
CACHE STRING "Extra arguments for CLANGANALYZER") | ||||
MARK_AS_ADVANCED (CLANGANALYZER_EXTRA_ARGS) | ||||
r0 | ||||
mperrinel
|
r14 | # Add the analyze target to launch CLANGANALYZER | ||
r0 | ADD_CUSTOM_TARGET (analyze | |||
COMMAND | ||||
mperrinel
|
r14 | sh ${CMAKE_CURRENT_SOURCE_DIR}/analyzer/launch-clang-analyzer-linux.sh | ||
r0 | ) | |||
mperrinel
|
r14 | ELSE (CLANGANALYZER_FOUND) | ||
MESSAGE (STATUS "The source code won't be analyzed - CLANGANALYZER not found") | ||||
ENDIF (CLANGANALYZER_FOUND) | ||||
ENDIF (ENABLE_ANALYSIS) | ||||