TARGET_PROPERTY COMPILE_DEFINITIONS doesn't work when repeated
See this example:
project(bugbug)
cmake_minimum_required(VERSION 3.20)
file(WRITE bugbug.c)
add_library(song INTERFACE)
target_compile_definitions(song INTERFACE bug)
add_library(dance STATIC bugbug.c)
target_link_libraries(dance PRIVATE song)
add_library(concert STATIC $<TARGET_PROPERTY:dance,COMPILE_DEFINITIONS>$<TARGET_PROPERTY:dance,COMPILE_DEFINITIONS>.c)
The generator expression evaluates to bug.c
instead of bugbug.c
and CMake fails with this message:
CMake Error at CMakeLists.txt:12 (add_library):
Cannot find source file:
bug.c