@@ -2,70 +2,70 @@ set(LLVM_LINK_COMPONENTS
22 AllTargetsAsmParsers
33 AllTargetsDescs
44 AllTargetsInfos
5+ FrontendOpenMP
6+ TargetParser
57 support
68 )
79
8- add_clang_executable (O2codecheck
10+ # Needed by LLVM's CMake checks because this file defines multiple targets.
11+ set (LLVM_OPTIONAL_SOURCES ClangTidyMain.cpp ClangTidyToolMain.cpp)
12+
13+ add_clang_library (clangTidyMain STATIC
914 ClangTidyMain.cpp
15+
16+ LINK_LIBS
17+ clangTidy
18+ ${ALL_CLANG_TIDY_CHECKS}
19+
20+ DEPENDS
21+ omp_gen
22+ ClangDriverOptions
1023 )
1124
12- target_link_libraries ( O2codecheck
25+ clang_target_link_libraries ( clangTidyMain
1326 PRIVATE
1427 clangAST
1528 clangASTMatchers
1629 clangBasic
17- clangTidy
18-
19- # link our own checks
20- clangTidyAliceO2Module
21- clangTidyReportingModule
22-
23- # include checkers available from main clang-tidy
24- clangTidyAlteraModule
25- clangTidyAndroidModule
26- clangTidyAbseilModule
27- clangTidyBoostModule
28- clangTidyBugproneModule
29- clangTidyCERTModule
30- clangTidyConcurrencyModule
31- clangTidyCppCoreGuidelinesModule
32- clangTidyDarwinModule
33- clangTidyFuchsiaModule
34- clangTidyGoogleModule
35- clangTidyHICPPModule
36- clangTidyLinuxKernelModule
37- clangTidyLLVMModule
38- clangTidyLLVMLibcModule
39- clangTidyMiscModule
40- clangTidyModernizeModule
41- clangTidyMPIModule
42- clangTidyObjCModule
43- clangTidyOpenMPModule
44- clangTidyPerformanceModule
45- clangTidyPortabilityModule
46- clangTidyReadabilityModule
47- clangTidyZirconModule
4830 clangTooling
4931 clangToolingCore
5032 )
5133
52- install (TARGETS O2codecheck
53- RUNTIME DESTINATION bin)
34+ # Support plugins.
35+ if (CLANG_PLUGIN_SUPPORT)
36+ set (support_plugins SUPPORT_PLUGINS)
37+ endif ()
38+
39+ add_clang_tool (clang-tidy
40+ ClangTidyToolMain.cpp
5441
55- #install(PROGRAMS clang-tidy-diff.py DESTINATION share/clang)
56- install (PROGRAMS run_O2CodeChecker.py DESTINATION bin)
42+ DEPENDS
43+ clang-resource-headers
44+ ${support_plugins}
45+ )
46+ clang_target_link_libraries (clang-tidy
47+ PRIVATE
48+ clangAST
49+ clangASTMatchers
50+ clangBasic
51+ clangTooling
52+ clangToolingCore
53+ )
54+ target_link_libraries (clang-tidy
55+ PRIVATE
56+ clangTidy
57+ clangTidyMain
58+ ${ALL_CLANG_TIDY_CHECKS}
59+ )
5760
58- # we need to install the builtin headers in a path which is searched by the tool
59- # FIXME: a soft link would be better
60- string (REPLACE "." ";" LLVM_PACKAGE_VERSION_LIST ${LLVM_PACKAGE_VERSION} )
61- list (GET LLVM_PACKAGE_VERSION_LIST 0 LLVM_PACKAGE_VERSION_MAJOR)
62- install (DIRECTORY ${LLVM_LIBRARY_DIR} /clang/${LLVM_PACKAGE_VERSION_MAJOR} /include DESTINATION lib/clang/${LLVM_PACKAGE_VERSION_MAJOR} )
61+ if (CLANG_PLUGIN_SUPPORT)
62+ export_executable_symbols_for_plugins (clang-tidy )
63+ endif ()
6364
64- IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
65- # On MacOS we need to do the same with C++ headers since they are in a non-standard location
66- # (alternative would be to set the CPATH environment variable)
67- INSTALL (CODE "execute_process(COMMAND mkdir ${CMAKE_INSTALL_PREFIX} /include)" )
68- INSTALL (CODE "execute_process(COMMAND ln -sf \
69- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++ \
70- ${CMAKE_INSTALL_PREFIX} /include/c++)" )
71- ENDIF ()
65+ install (PROGRAMS clang-tidy-diff.py
66+ DESTINATION "${CMAKE_INSTALL_DATADIR} /clang"
67+ COMPONENT clang-tidy)
68+ install (PROGRAMS run-clang-tidy.py
69+ DESTINATION "${CMAKE_INSTALL_BINDIR} "
70+ COMPONENT clang-tidy
71+ RENAME run-clang-tidy)
0 commit comments