Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 1 | option(CLANG_INSTALL_SCANBUILD "Install the scan-build tool" ON) |
| 2 | |
Chris Bieneman | 0502e98 | 2015-11-20 18:49:02 +0000 | [diff] [blame] | 3 | include(GNUInstallDirs) |
| 4 | |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 5 | if (WIN32 AND NOT CYGWIN) |
| 6 | set(BinFiles |
Jonathan Roelofs | 7121c00 | 2017-03-22 21:13:49 +0000 | [diff] [blame] | 7 | scan-build |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 8 | scan-build.bat) |
| 9 | set(LibexecFiles |
Jonathan Roelofs | 7121c00 | 2017-03-22 21:13:49 +0000 | [diff] [blame] | 10 | ccc-analyzer |
| 11 | c++-analyzer |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 12 | ccc-analyzer.bat |
| 13 | c++-analyzer.bat) |
| 14 | else() |
| 15 | set(BinFiles |
| 16 | scan-build) |
| 17 | set(LibexecFiles |
| 18 | ccc-analyzer |
| 19 | c++-analyzer) |
| 20 | if (APPLE) |
Jonathan Roelofs | 1ff9c63 | 2015-11-10 22:48:11 +0000 | [diff] [blame] | 21 | list(APPEND BinFiles |
| 22 | set-xcode-analyzer) |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 23 | endif() |
| 24 | endif() |
| 25 | |
| 26 | set(ManPages |
| 27 | scan-build.1) |
| 28 | |
Jonathan Roelofs | 2ec2acb | 2015-11-13 00:32:54 +0000 | [diff] [blame] | 29 | set(ShareFiles |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 30 | scanview.css |
| 31 | sorttable.js) |
| 32 | |
| 33 | |
| 34 | if(CLANG_INSTALL_SCANBUILD) |
| 35 | foreach(BinFile ${BinFiles}) |
Jonathan Roelofs | 467ab05 | 2015-11-10 22:38:59 +0000 | [diff] [blame] | 36 | add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/${BinFile} |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 37 | COMMAND ${CMAKE_COMMAND} -E make_directory |
| 38 | ${CMAKE_BINARY_DIR}/bin |
| 39 | COMMAND ${CMAKE_COMMAND} -E copy |
Jonathan Roelofs | 814aa25 | 2015-11-13 20:34:15 +0000 | [diff] [blame] | 40 | ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile} |
Jonathan Roelofs | 2a439a1 | 2015-11-10 20:01:22 +0000 | [diff] [blame] | 41 | ${CMAKE_BINARY_DIR}/bin/ |
Jonathan Roelofs | 814aa25 | 2015-11-13 20:34:15 +0000 | [diff] [blame] | 42 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}) |
Jonathan Roelofs | 1ff9c63 | 2015-11-10 22:48:11 +0000 | [diff] [blame] | 43 | list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile}) |
Jonathan Roelofs | 814aa25 | 2015-11-13 20:34:15 +0000 | [diff] [blame] | 44 | install(PROGRAMS bin/${BinFile} DESTINATION bin) |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 45 | endforeach() |
| 46 | |
| 47 | foreach(LibexecFile ${LibexecFiles}) |
Jonathan Roelofs | 467ab05 | 2015-11-10 22:38:59 +0000 | [diff] [blame] | 48 | add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/libexec/${LibexecFile} |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 49 | COMMAND ${CMAKE_COMMAND} -E make_directory |
| 50 | ${CMAKE_BINARY_DIR}/libexec |
| 51 | COMMAND ${CMAKE_COMMAND} -E copy |
Jonathan Roelofs | 814aa25 | 2015-11-13 20:34:15 +0000 | [diff] [blame] | 52 | ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile} |
Jonathan Roelofs | 2a439a1 | 2015-11-10 20:01:22 +0000 | [diff] [blame] | 53 | ${CMAKE_BINARY_DIR}/libexec/ |
Jonathan Roelofs | 814aa25 | 2015-11-13 20:34:15 +0000 | [diff] [blame] | 54 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile}) |
Jonathan Roelofs | 1ff9c63 | 2015-11-10 22:48:11 +0000 | [diff] [blame] | 55 | list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile}) |
Jonathan Roelofs | 814aa25 | 2015-11-13 20:34:15 +0000 | [diff] [blame] | 56 | install(PROGRAMS libexec/${LibexecFile} DESTINATION libexec) |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 57 | endforeach() |
| 58 | |
| 59 | foreach(ManPage ${ManPages}) |
Chris Bieneman | 0502e98 | 2015-11-20 18:49:02 +0000 | [diff] [blame] | 60 | add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage} |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 61 | COMMAND ${CMAKE_COMMAND} -E make_directory |
Chris Bieneman | 0502e98 | 2015-11-20 18:49:02 +0000 | [diff] [blame] | 62 | ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1 |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 63 | COMMAND ${CMAKE_COMMAND} -E copy |
Jonathan Roelofs | 814aa25 | 2015-11-13 20:34:15 +0000 | [diff] [blame] | 64 | ${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage} |
Chris Bieneman | 0502e98 | 2015-11-20 18:49:02 +0000 | [diff] [blame] | 65 | ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/ |
Jonathan Roelofs | 814aa25 | 2015-11-13 20:34:15 +0000 | [diff] [blame] | 66 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage}) |
Chris Bieneman | 0502e98 | 2015-11-20 18:49:02 +0000 | [diff] [blame] | 67 | list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage}) |
| 68 | install(PROGRAMS man/${ManPage} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 69 | endforeach() |
| 70 | |
Jonathan Roelofs | 2ec2acb | 2015-11-13 00:32:54 +0000 | [diff] [blame] | 71 | foreach(ShareFile ${ShareFiles}) |
Jonathan Roelofs | 80df3d2 | 2015-11-13 19:56:07 +0000 | [diff] [blame] | 72 | add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile} |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 73 | COMMAND ${CMAKE_COMMAND} -E make_directory |
Jonathan Roelofs | 80df3d2 | 2015-11-13 19:56:07 +0000 | [diff] [blame] | 74 | ${CMAKE_BINARY_DIR}/share/scan-build |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 75 | COMMAND ${CMAKE_COMMAND} -E copy |
Jonathan Roelofs | 814aa25 | 2015-11-13 20:34:15 +0000 | [diff] [blame] | 76 | ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile} |
Jonathan Roelofs | 80df3d2 | 2015-11-13 19:56:07 +0000 | [diff] [blame] | 77 | ${CMAKE_BINARY_DIR}/share/scan-build/ |
Jonathan Roelofs | 814aa25 | 2015-11-13 20:34:15 +0000 | [diff] [blame] | 78 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile}) |
Jonathan Roelofs | 80df3d2 | 2015-11-13 19:56:07 +0000 | [diff] [blame] | 79 | list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile}) |
Jonathan Roelofs | 814aa25 | 2015-11-13 20:34:15 +0000 | [diff] [blame] | 80 | install(FILES share/scan-build/${ShareFile} DESTINATION share/scan-build) |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 81 | endforeach() |
Jonathan Roelofs | 467ab05 | 2015-11-10 22:38:59 +0000 | [diff] [blame] | 82 | |
| 83 | add_custom_target(scan-build ALL DEPENDS ${Depends}) |
Aaron Ballman | 8f3f634 | 2015-11-11 18:13:42 +0000 | [diff] [blame] | 84 | set_target_properties(scan-build PROPERTIES FOLDER "Misc") |
Jonathan Roelofs | e961432 | 2015-11-09 16:12:56 +0000 | [diff] [blame] | 85 | endif() |