Self-links via ALIAS targets should be an error
This code:
add_library(foo SHARED somefile.cpp)
target_link_libraries(foo PRIVATE foo)
reports an error:
CMake Error at CMakeLists.txt:11 (add_library):
Target "foo" links to itself.
This code should too, but does not:
add_library(foo SHARED somefile.cpp)
add_library(Bar::foo ALIAS foo)
target_link_libraries(foo PRIVATE Bar::foo)