xref: /llvm-project/clang/tools/scan-view/CMakeLists.txt (revision 10d0d8c0c1db57b7ff465df7ced78a42a20d592d)
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      bugcatcher.ico)
11
12if(CLANG_INSTALL_SCANVIEW)
13  foreach(BinFile ${BinFiles})
14    add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/${BinFile}
15                       COMMAND ${CMAKE_COMMAND} -E make_directory
16                         ${CMAKE_BINARY_DIR}/bin
17                       COMMAND ${CMAKE_COMMAND} -E copy
18                         ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}
19                         ${CMAKE_BINARY_DIR}/bin/
20                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
21    list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
22    install(PROGRAMS bin/${BinFile}
23            DESTINATION "${CMAKE_INSTALL_BINDIR}"
24            COMPONENT scan-view)
25  endforeach()
26
27  foreach(ShareFile ${ShareFiles})
28    add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile}
29                       COMMAND ${CMAKE_COMMAND} -E make_directory
30                         ${CMAKE_BINARY_DIR}/share/scan-view
31                       COMMAND ${CMAKE_COMMAND} -E copy
32                         ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile}
33                         ${CMAKE_BINARY_DIR}/share/scan-view/
34                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
35    list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
36    install(FILES share/${ShareFile}
37            DESTINATION "${CMAKE_INSTALL_DATADIR}/scan-view"
38            COMPONENT scan-view)
39  endforeach()
40
41  add_custom_target(scan-view ALL DEPENDS ${Depends})
42  set_target_properties(scan-view PROPERTIES FOLDER "Misc")
43
44  if(NOT LLVM_ENABLE_IDE)
45    add_llvm_install_targets("install-scan-view"
46                             DEPENDS scan-view
47                             COMPONENT scan-view)
48  endif()
49endif()
50