[CMake] CMake Error: install(EXPORT "A" ...) includes target "b" which requires target "c" that is not in this export set, but x times in others.

Alexander Neundorf a.neundorf-work at gmx.net
Wed Oct 8 15:48:01 EDT 2014


On Wednesday, October 08, 2014 18:40:53 Nico Schlömer wrote:
> Hi all,
> 
> in on CMake project of mine, all seems to configure fine until the
> very end where I'm getting error messages like
> ```
> CMake Error: install(EXPORT "A" ...) includes target "b" which
> requires target "c" that is not in this export set, but x times in
> others.
> ```
> First of all, CMake does seem to create all files necessary for
> building the project, since that goes without error. Hence, I'm not
> really sure CMake yells at me.
> Second, I don't really understand the message. Indeed, I have a couple
> of export sets in my project, and the libraries there in depend on
> each other. Why the target "c" need to be in the same export set as
> "b"?

It doesn't.
If target c depends on target b, and target c is exported, cmake checks that 
target b is exported too. This is necessary so cmake can put the name of the 
exported "b" library into the dependencies of c.
This is possible if b is exported in the same export set as c, or if b is in a 
different export set, but only in one. Then cmake can use the name of the 
exported target b as it is used in the other export set.
If b is exported in multiple export sets, each of these export sets can use a 
different namespace, and it is not clear which of these different names for b 
should be used as dependency for c.
If b is in only one export set, it will be used with the namespace as used 
there in the list of dependencies of c.

Alex



More information about the CMake mailing list