罗勇刚(Yonggang Luo)
2009-Oct-07 14:57 UTC
[LLVMdev] Hi, everyone, fail on building c-index-test
> > 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++* 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. -- 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091007/0f52982b/attachment.html>
Douglas Gregor
2009-Oct-07 15:32 UTC
[LLVMdev] Hi, everyone, fail on building c-index-test
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>
罗勇刚(Yonggang Luo)
2009-Oct-09 10:14 UTC
[LLVMdev] Hi, everyone, fail on building c-index-test
Mmm, do you see that patch? Because the order of those linked library is incorrect. Mingw can't generate libCindex.dll. So I midified the likage order. Also, for the reason of removing duplicated code, I removed some unnecessay cmake code. And add an new cmake function 2009/10/7, Douglas Gregor <dgregor at apple.com>:> > On Oct 7, 2009, at 8:36 AM, 罗勇刚(Yonggang Luo) wrote: > >> That does not mean that every library or application built within >> the LLVM tree must be linked as C++. >> That's right, so I create an new patch to resolve this problem(Now, >> it's only when the app link with the llvm library then it's will set >> the linkage target as CXX, or it's apply the default cmake >> LINKAGE_LAN), also it's resolved another problem appeared on CIndex/ >> Mingw > > What other problem? > > - Doug-- 从我的移动设备发送 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo
Apparently Analagous Threads
- [LLVMdev] Hi, everyone, fail on building c-index-test
- [LLVMdev] Hi, everyone, fail on building c-index-test
- [LLVMdev] Hi, everyone, fail on building c-index-test
- [LLVMdev] patch for CIndex linakge error on Mingw, set the proper LINKER_LANGUAGE for CIndex and c-index-test
- [LLVMdev] Summer of Code idea -- detecting undefined behavior