Hello developper friends, I'm using CMake for a while now, but I could't figure how to install a target :
- that is part of an export set
- that link privately against interface library
The export set is created with the command
install(EXPORT MyExportSet DESTINATION MyExportDir
NAMESPACE Project FILE ProjectTargets.cmake)
the link to the interface library is done like this
target_link_libraries(exportedTarget
PRIVATE interfaceTargetLibrary
)
and finally i'm exporting the target like this :
install(TARGETS exportedTarget EXPORT MyExportSet
ARCHIVE DESTINATION lib/static
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
This look rights to me, and following the logic of the PRIVATE flag uppon linking, I shouldn't have to export the target interfaceTargetLibrary
But CMake throw me an error (This one)
CMake Error: install(EXPORT "ProjectTargets" ...) includes target"exportedTargets" which requires target "interfaceTargetLibrary" that is not in the export set.
So here my question, is that a bug ? or something I didn't understand ? And obviously did you achieve to make it work on way or another.
I'm using CMake version 3.7.
EDIT : Finded out, if someone interested. It's because, the library that is linked privately wont be packaged in the one I export. So, the comsummer of the library will need, to link against interfaceTargetLibary
too and so I need to export it as well.