2013-07-29 16:19:24 +08:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
2017-10-21 19:02:30 +08:00
|
|
|
AllTargetsAsmParsers
|
|
|
|
AllTargetsDescs
|
|
|
|
AllTargetsInfos
|
2020-04-08 11:44:43 +08:00
|
|
|
FrontendOpenMP
|
2013-07-29 16:19:24 +08:00
|
|
|
support
|
|
|
|
)
|
|
|
|
|
2020-01-24 08:42:14 +08:00
|
|
|
# Needed by LLVM's CMake checks because this file defines multiple targets.
|
|
|
|
set(LLVM_OPTIONAL_SOURCES ClangTidyMain.cpp ClangTidyToolMain.cpp)
|
|
|
|
|
|
|
|
add_clang_library(clangTidyMain
|
2013-07-29 16:19:24 +08:00
|
|
|
ClangTidyMain.cpp
|
2020-01-24 08:42:14 +08:00
|
|
|
|
|
|
|
LINK_LIBS
|
|
|
|
clangAST
|
|
|
|
clangASTMatchers
|
|
|
|
clangBasic
|
|
|
|
clangTidy
|
|
|
|
${ALL_CLANG_TIDY_CHECKS}
|
|
|
|
clangTooling
|
|
|
|
clangToolingCore
|
|
|
|
)
|
|
|
|
|
|
|
|
add_clang_tool(clang-tidy
|
|
|
|
ClangTidyToolMain.cpp
|
2013-07-29 16:19:24 +08:00
|
|
|
)
|
2016-07-07 21:19:45 +08:00
|
|
|
add_dependencies(clang-tidy
|
[build] Rename clang-headers to clang-resource-headers
Summary:
The current install-clang-headers target installs clang's resource
directory headers. This is different from the install-llvm-headers
target, which installs LLVM's API headers. We want to introduce the
corresponding target to clang, and the natural name for that new target
would be install-clang-headers. Rename the existing target to
install-clang-resource-headers to free up the install-clang-headers name
for the new target, following the discussion on cfe-dev [1].
I didn't find any bots on zorg referencing install-clang-headers. I'll
send out another PSA to cfe-dev to accompany this rename.
[1] http://lists.llvm.org/pipermail/cfe-dev/2019-February/061365.html
Reviewers: beanz, phosek, tstellar, rnk, dim, serge-sans-paille
Subscribers: mgorny, javed.absar, jdoerfert, #sanitizers, openmp-commits, lldb-commits, cfe-commits, llvm-commits
Tags: #clang, #sanitizers, #lldb, #openmp, #llvm
Differential Revision: https://reviews.llvm.org/D58791
llvm-svn: 355340
2019-03-05 05:19:53 +08:00
|
|
|
clang-resource-headers
|
2016-07-07 21:19:45 +08:00
|
|
|
)
|
2019-10-05 04:30:02 +08:00
|
|
|
clang_target_link_libraries(clang-tidy
|
[CMake] Use PRIVATE in target_link_libraries for executables
We currently use target_link_libraries without an explicit scope
specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables.
Dependencies added in this way apply to both the target and its
dependencies, i.e. they become part of the executable's link interface
and are transitive.
Transitive dependencies generally don't make sense for executables,
since you wouldn't normally be linking against an executable. This also
causes issues for generating install export files when using
LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM
library dependencies, which are currently added as interface
dependencies. If clang is in the distribution components but the LLVM
libraries it depends on aren't (which is a perfectly legitimate use case
if the LLVM libraries are being built static and there are therefore no
run-time dependencies on them), CMake will complain about the LLVM
libraries not being in export set when attempting to generate the
install export file for clang. This is reasonable behavior on CMake's
part, and the right thing is for LLVM's build system to explicitly use
PRIVATE dependencies for executables.
Unfortunately, CMake doesn't allow you to mix and match the keyword and
non-keyword target_link_libraries signatures for a single target; i.e.,
if a single call to target_link_libraries for a particular target uses
one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must
also be updated to use those keywords. This means we must do this change
in a single shot. I also fully expect to have missed some instances; I
tested by enabling all the projects in the monorepo (except dragonegg),
and configuring both with and without shared libraries, on both Darwin
and Linux, but I'm planning to rely on the buildbots for other
configurations (since it should be pretty easy to fix those).
Even after this change, we still have a lot of target_link_libraries
calls that don't specify a scope keyword, mostly for shared libraries.
I'm thinking about addressing those in a follow-up, but that's a
separate change IMO.
Differential Revision: https://reviews.llvm.org/D40823
llvm-svn: 319840
2017-12-06 05:49:56 +08:00
|
|
|
PRIVATE
|
2013-12-10 09:41:10 +08:00
|
|
|
clangAST
|
|
|
|
clangASTMatchers
|
2015-03-13 11:47:43 +08:00
|
|
|
clangBasic
|
2013-12-10 09:41:10 +08:00
|
|
|
clangTooling
|
2017-04-13 06:07:47 +08:00
|
|
|
clangToolingCore
|
2019-10-05 04:30:02 +08:00
|
|
|
)
|
|
|
|
target_link_libraries(clang-tidy
|
|
|
|
PRIVATE
|
|
|
|
clangTidy
|
2020-01-24 08:42:14 +08:00
|
|
|
clangTidyMain
|
2019-09-27 20:56:14 +08:00
|
|
|
${ALL_CLANG_TIDY_CHECKS}
|
2013-07-29 16:19:24 +08:00
|
|
|
)
|
|
|
|
|
2018-10-02 04:24:22 +08:00
|
|
|
|
2017-11-02 09:48:20 +08:00
|
|
|
install(PROGRAMS clang-tidy-diff.py
|
|
|
|
DESTINATION share/clang
|
|
|
|
COMPONENT clang-tidy)
|
|
|
|
install(PROGRAMS run-clang-tidy.py
|
|
|
|
DESTINATION share/clang
|
|
|
|
COMPONENT clang-tidy)
|