[llvm-dev] add_library cannot create target "LLVMTarget" because an imported target with the same name already exists.

Simone Atzeni via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 28 14:26:20 PST 2016

Hi Chris,

sorry I was just using a dummy name for the library but that wasn’t the name that was giving me the error.
However, what I am experiencing is that if I build and install my pass within the LLVM source I cannot install my library if I build it out-of-tree as a standalone library.
The OpenMP runtime allows that though, any solution?


> On Nov 28, 2016, at 15:22, Chris Bieneman <beanz at apple.com> wrote:
> Hi Simone,
> Sorry for the delayed response.
> LLVMTarget is a library provided by LLVM, you shouldn't be naming your own targets to conflict with the names already in LLVM. CMake does not allow multiple targets to have the same name because it causes ambiguities in the build system.
> -Chris
>> On Nov 20, 2016, at 2:00 PM, Simone Atzeni via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>> Hi,
>> I am trying to make my pass compiling inside the LLVM tree or outside.
>> It works when I include my pass inside the tools folder, however when I try to compile it outside the LLVM tree I get the following error:
>> "add_library cannot create target "LLVMTarget" because an imported target with the same name already exists.”
>> It happens when I’ve already compiled and installed my target from within LLVM.
>> I was wondering if there is a way to ignore that and just overwrite the target.
>> Thanks.
>> Best,
>> Simone
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

More information about the llvm-dev mailing list