[LLVMdev] Hi, everyone, fail on building c-index-test

Douglas Gregor dgregor at apple.com
Wed Oct 7 08:32:32 PDT 2009


On Oct 7, 2009, at 7:57 AM, 罗勇刚(Yonggang Luo) wrote:

> I've committed my suggested fix. There's no point in setting the  
> LINKER_LANGUAGE property of every LLVM library, because CMake  
> figures out the right language based on the file extensions of the  
> source files.
> Yes, CMake figures out the right language based on the file  
> extensions of the source files.
> But, llvm is based on C++

That does not mean that every library or application built within the  
LLVM tree must be linked as C++.

> for example, if you create a application just containing C extension  
> files,
> but using llvm as the midware, then CMake system must auto   
> recognize the LINKER_LANGUAGE as CXX, but not C. Even all source  
> files in this project is C extension.
>
> Now, it's using a strange hack, just
>
> set_target_properties(c-index-test
>   PROPERTIES
>   LINKER_LANGUAGE CXX)
> It's not reasonable, because it's not because of  c-index-test.c  
> lead the
> LINKER_LANGUAGE  to be CXX
> but llvm make this happened, so it's shouldn't be placed at
> c-index-test.c/CMakeLists.txt
> and should be placed at
> AddLLVM.cmake
> That's means, every  new project(OR executable) using LLVM as the  
> dependent,
> then  then
> LINKER_LANGUAGE   must be set to CXX in an auto way,
> but not set it manually.


There is only one place in the entire LLVM + Clang source tree where  
we need to explicitly set the linker language to C++. There is no  
point in trying to generalize when there is only one example, and we  
don't know if the next target we add that has only .c files will  
require C++ linkage or not. If it does, we can decide to generalize  
then (or not).

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091007/76c04306/attachment.html>


More information about the llvm-dev mailing list