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} DESTINATION bin)
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} DESTINATION share/scan-view)
37  endforeach()
38
39  add_custom_target(scan-view ALL DEPENDS ${Depends})
40  set_target_properties(scan-view PROPERTIES FOLDER "Misc")
41endif()
42