1option(CLANG_INSTALL_SCANVIEW "Install the scan-view tool" ON)
2
3set(BinFiles
4      scan-view)
5
6set(ShareFiles
7      ScanView.py
8      Reporter.py
9      startfile.py
10      FileRadar.scpt
11      GetRadarVersion.scpt
12      bugcatcher.ico)
13
14if(CLANG_INSTALL_SCANVIEW)
15  foreach(BinFile ${BinFiles})
16    add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/${BinFile}
17                       COMMAND ${CMAKE_COMMAND} -E make_directory
18                         ${CMAKE_BINARY_DIR}/bin
19                       COMMAND ${CMAKE_COMMAND} -E copy
20                         ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}
21                         ${CMAKE_BINARY_DIR}/bin/
22                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
23    list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
24    install(PROGRAMS bin/${BinFile}
25            DESTINATION bin
26            COMPONENT scan-view)
27  endforeach()
28
29  foreach(ShareFile ${ShareFiles})
30    add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile}
31                       COMMAND ${CMAKE_COMMAND} -E make_directory
32                         ${CMAKE_BINARY_DIR}/share/scan-view
33                       COMMAND ${CMAKE_COMMAND} -E copy
34                         ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile}
35                         ${CMAKE_BINARY_DIR}/share/scan-view/
36                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
37    list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
38    install(FILES share/${ShareFile}
39            DESTINATION share/scan-view
40            COMPONENT scan-view)
41  endforeach()
42
43  add_custom_target(scan-view ALL DEPENDS ${Depends})
44  set_target_properties(scan-view PROPERTIES FOLDER "Misc")
45
46  if(NOT LLVM_ENABLE_IDE)
47    add_llvm_install_targets("install-scan-view"
48                             DEPENDS scan-view
49                             COMPONENT scan-view)
50  endif()
51endif()
52