Given the following minimal project:

cmake_minimum_required(VERSION 3.25)
add_library(lib1 STATIC lib1.cpp)
add_library(lib2 STATIC lib2.cpp)
#target_link_libraries(lib2 PRIVATE lib1)                               # case 1: <-- use this OR the line below ONLY
set_property(TARGET lib2 PROPERTY INTERFACE_LINK_LIBRARIES_DIRECT lib1) # case 2: <-- use this OR the line above ONLY
add_executable(app main.cpp)
target_link_libraries(app PRIVATE $<LINK_LIBRARY:WHOLE_ARCHIVE,lib2>)

If I use target_link_libraries(lib2 PRIVATE lib1) (case 1 above) it works normally as expected, link line from compiling:

link.exe ... /WHOLEARCHIVE:Debug\lib2.lib Debug\lib1.lib ...

However if I use case 2: set_property(TARGET lib2 PROPERTY INTERFACE_LINK_LIBRARIES_DIRECT lib1), and comment case 1 of course, then I get:

link.exe ... /WHOLEARCHIVE:Debug\lib1.lib /WHOLEARCHIVE:Debug\lib2.lib ...

Now lib1.lib also gets WHOLEARCHIVE-d, even though it’s not specified anywhere. Now why is that? I couldn’t find any hint in the documentation of INTERFACE_LINK_LIBRARIES_DIRECT and/or the LINK_LIBRARY genex that this is intended behavior.

Is this a bug, an undocumented feature or a side-effect (or something else)?

Note: the above is a hypothetical minimal example, obviously our actual use-case is much more complex…

This is clearly a bug. The library specified by INTERFACE_LINK_LIBRARIES_DIRECT property seems not injected at the right place in the direct dependencies of the final target.
Can-you create an issue for this problem?