alias target

I’m getting a cmake error on my module
target_link_libraries can not be used on an ALIAS target.

I’ve gone through the online cmake tutorial, think I understand aliases but cannot see why my command
is being interpreted as an alias target the offending command
is
add_library(meta ${classes})

thanks,
David

Could you provide more context here? I suspect you are making a VTK module and trying to use CMake’s target_* commands. VTK modules have a layer of abstraction on top (to handle kits) and vtk_module_link should be used instead with the module name.

Yes I’m trying to build my own module. I’m attaching the CMakeLists.txt file.
I thught module and target names were separate.

CMakeLists.txt (2.42 KB)

They are; that’s why there are the vtk_module_* commands which take module names instead of target names. These commands strip off the ALIAS and set it on the actual underlying target which might not be the part after :: due to kits “renaming” the underlying target to have a suffix of -objects. vtk_module_link also needs to do some bookkeeping for PRIVATE link libraries to make them work as well.