CMakeLists.txt
3.66 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
option(CLANG_INSTALL_SCANBUILD "Install the scan-build tool" ON)
include(GNUInstallDirs)
if (WIN32 AND NOT CYGWIN)
set(BinFiles
scan-build
scan-build.bat)
set(LibexecFiles
ccc-analyzer
c++-analyzer
ccc-analyzer.bat
c++-analyzer.bat)
else()
set(BinFiles
scan-build)
set(LibexecFiles
ccc-analyzer
c++-analyzer)
if (APPLE)
list(APPEND BinFiles
set-xcode-analyzer)
endif()
endif()
set(ManPages
scan-build.1)
set(ShareFiles
scanview.css
sorttable.js)
if(CLANG_INSTALL_SCANBUILD)
foreach(BinFile ${BinFiles})
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/${BinFile}
COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_BINARY_DIR}/bin
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}
${CMAKE_BINARY_DIR}/bin/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
install(PROGRAMS bin/${BinFile}
DESTINATION bin
COMPONENT scan-build)
endforeach()
foreach(LibexecFile ${LibexecFiles})
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/libexec/${LibexecFile}
COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_BINARY_DIR}/libexec
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile}
${CMAKE_BINARY_DIR}/libexec/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
install(PROGRAMS libexec/${LibexecFile}
DESTINATION libexec
COMPONENT scan-build)
endforeach()
foreach(ManPage ${ManPages})
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage}
COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage}
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage})
list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage})
install(PROGRAMS man/${ManPage}
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
COMPONENT scan-build)
endforeach()
foreach(ShareFile ${ShareFiles})
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile}
COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_BINARY_DIR}/share/scan-build
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile}
${CMAKE_BINARY_DIR}/share/scan-build/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
install(FILES share/scan-build/${ShareFile}
DESTINATION share/scan-build
COMPONENT scan-build)
endforeach()
add_custom_target(scan-build ALL DEPENDS ${Depends})
set_target_properties(scan-build PROPERTIES FOLDER "Misc")
if(NOT LLVM_ENABLE_IDE)
add_llvm_install_targets("install-scan-build"
DEPENDS scan-build
COMPONENT scan-build)
endif()
endif()