$<TARGET_PROPERTY:prop> doesn't work with --graphviz
Generator expressions of type "$<TARGET_PROPERTY:prop>" don't work as expected with --graphviz. For example:
cmake_minimum_required(VERSION 3.20)
project(TEST)
add_library(lib_a_ver_1 STATIC dummy1.cpp)
add_library(lib_a_ver_2 STATIC dummy2.cpp)
add_library(lib_a INTERFACE)
target_link_libraries(lib_a
INTERFACE
$<IF:$<BOOL:$<TARGET_PROPERTY:USE_VER_1>>,lib_a_ver_1,lib_a_ver_2>
)
add_executable(exe_a dummy.cpp)
target_link_libraries(exe_a PUBLIC lib_a)
set_target_properties(exe_a PROPERTIES USE_VER_1 TRUE)
add_executable(exe_b dummy.cpp)
target_link_libraries(exe_b PUBLIC lib_a)
set_target_properties(exe_b PROPERTIES USE_VER_1 FALSE)
When tested with CMake version 3.20.6 by executing command "cmake -G Ninja -B out --graphviz=out/foo.dot" the dependencies in build.ninja are as expected: exe_a depends on lib_a_ver_1 and exe_b depends on lib_a_ver_2. But in both foo.dot.exe_a and foo.dot.exe_b there's the same dependency: lib_a -> lib_a_ver_2. In foo.dot.exe_a the dependency should be: lib_a -> lib_a_ver_1.
If "$<TARGET_PROPERTY:USE_VER_1>" is replaced by a variable then the dependencies in foo.dot.exe_a and foo.dot.exe_b are as expected for both TRUE and FALSE.
Probably related issue: #18012