llvm-project/clang
Han Zhu 0c9230dad1 Reland [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON
f8990feb12 enabled installing PIC version of both libclang.a and
libclang.so when LIBCLANG_BUILD_STATIC is ON. But it broke the no-PIC
build when LLVM_ENABLE_PIC=OFF with the following error:

```
CMake Error at
/b/s/w/ir/cache/builder/src/third_party/llvm/clang/tools/libclang/CMakeLists.txt:123
(target_compile_definitions):
    target_compile_definitions called with non-compilable target type
```

This is because as the code loops through ${name} and ${name}_static, it
introduced a side effect, which is adding an empty libclang_static to
targets. Later target_compile_definitions is called on libclang_static.
That function requires that target must have been created by a command
such as add_executable() or add_library(), so it crashed.

The solution is to not naively loop through both libclang and
libclang_static, but only the ones that are actually added by
llvm_add_library(). Here's the library build type to library target name
mapping:

| SHARED only | libclang |
| STATIC only | libclang |
| SHARED and STATIC | libclang and libclang_static |

So only when SHARED and STATIC are both set should we loop through two
targets. Explicitly parse the STATIC argument and set the list
accordingly.

Reviewed By: smeenai

Differential Revision: https://reviews.llvm.org/D79059
2020-05-06 19:33:58 -07:00
..
INPUTS
bindings Revert "Temporarily revert "build: use `find_package(Python3)` if available"" 2020-04-29 01:38:08 +00:00
cmake Reland [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON 2020-05-06 19:33:58 -07:00
docs clang-format: Add ControlStatementsExceptForEachMacros option to SpaceBeforeParens 2020-05-06 20:59:24 +02:00
examples Const-initialize ParsedAttrInfos 2020-03-28 19:04:53 +01:00
include [CUDA] Enable existing builtins for PTX7.0 as well. 2020-05-06 14:24:21 -07:00
lib [X86] Remove support for Y0 constraint as an alias for Yz in inline assembly. 2020-05-06 14:58:53 -07:00
runtime
test [X86] Remove support for Y0 constraint as an alias for Yz in inline assembly. 2020-05-06 14:58:53 -07:00
tools [NFC] Improve doc string to mention that paths in diff are used as-is 2020-05-06 15:20:05 -07:00
unittests clang-format: Add ControlStatementsExceptForEachMacros option to SpaceBeforeParens 2020-05-06 20:59:24 +02:00
utils Reapply "NFC: utils/perf-training: Python 3 compatibility for lit.cfg" 2020-05-05 15:56:23 -07:00
www [www] Update make_cxx_dr_status for v10; regenerate cxx_dr_status.html 2020-04-15 10:45:00 -04:00
.clang-format
.clang-tidy - Update .clang-tidy to ignore parameters of main like functions for naming violations in clang and llvm directory 2020-01-31 16:49:45 +00:00
.gitignore
CMakeLists.txt Revert "Temporarily revert "build: use `find_package(Python3)` if available"" 2020-04-29 01:38:08 +00:00
CODE_OWNERS.TXT
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt [NFC] test commit reverted 2019-12-21 22:12:07 +04:00

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:             http://clang.llvm.org/
Building and using Clang:         http://clang.llvm.org/get_started.html
Clang Static Analyzer:            http://clang-analyzer.llvm.org/
Information on the LLVM project:  http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/