[PATCH] D24442: cmake: Specify library dependences even without BUILD_SHARED_LIBS

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 14:42:12 PDT 2016


Meinersbur added a comment.

In https://reviews.llvm.org/D24442#541690, @grosser wrote:

> thank you for your feedback. This error happens with:
>
> -DBUILD_SHARED_LIBS=ON   -DPOLLY_ENABLE_GPGPU_CODEGEN=ON


Thanks.

> > Wouldn't it be a lot easier to target_link_libraries(opt LLVMTarget) if LINK_POLLY_INTO_TOOLS?

> 

> 

> Like:

> 

>   --- a/tools/bugpoint/CMakeLists.txt

>   +++ b/tools/bugpoint/CMakeLists.txt

>   @@ -39,4 +39,5 @@ if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)

>           target_link_libraries(bugpoint ${lib})

>         endforeach(lib)

>       endif(POLLY_LINK_LIBS)

>   +   target_link_libraries(bugpoint LLVMTarget) 

>      endif(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)

> 

> 

> This works as well. LLVMTarget is already part of bugpoints target_link_libraries, but adding it again ensures it is added once more at the end of linker command line, such that it is available to cover symbols only used by Polly, but not by bugpoint.

> 

> If this is preferable, I could just add this line.


I don't see any downsides. Maybe add a comment why LLVMTarget is linked twice?

There is `-Wl,--start-group -Wl,--end-group` to make library order not matter anymore, but I don't know how to make CMake use it.


https://reviews.llvm.org/D24442





More information about the llvm-commits mailing list