target_link_libraries: libaries are doubled, if other double entries with generator expressions exists
see attached sample:
CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(HelloWorld)
set(CMAKE_CXX_STANDARD 11)
add_executable(HelloWorld MACOSX_BUNDLE AppDelegate.mm)
find_library(COCOA_LIBRARY Cocoa)
#target_link_libraries(HelloWorld PRIVATE ${COCOA_LIBRARY})
# Bug: (does not occur, if the following lines are sorted alphabetically)
target_link_libraries(HelloWorld PRIVATE $<$<CONFIG:DEBUG>:/Users/PathDoesNotNeedToExist/Qt/6.5.3/macos/lib/QtCore.framework/QtCore> )
target_link_libraries(HelloWorld PRIVATE $<$<NOT:$<CONFIG:DEBUG>>:/Users/PathDoesNotNeedToExist/Qt/6.5.3/macos/lib/QtCore.framework/QtCore> )
target_link_libraries(HelloWorld PRIVATE $<$<CONFIG:DEBUG>:/Users/PathDoesNotNeedToExist/Qt/6.5.3/macos/lib/QtWidgets.framework/QtWidgets> )
target_link_libraries(HelloWorld PRIVATE $<$<NOT:$<CONFIG:DEBUG>>:/Users/PathDoesNotNeedToExist/Qt/6.5.3/macos/lib/QtWidgets.framework/QtWidgets> )
target_link_libraries(HelloWorld PRIVATE $<$<CONFIG:DEBUG>:/Users/PathDoesNotNeedToExist/Qt/6.5.3/macos/lib/QtCore.framework/QtCore> )
target_link_libraries(HelloWorld PRIVATE $<$<NOT:$<CONFIG:DEBUG>>:/Users/PathDoesNotNeedToExist/Qt/6.5.3/macos/lib/QtCore.framework/QtCore> )
target_link_libraries(HelloWorld PRIVATE FancyLibDoesNotNeedToExist )
if the target_link_libraries are in the order I provided, FancyLibDoesNotNeedToExist is also doubled if the target_link_libraries are sorted alphabetically, FancyLibDoesNotNeedToExist occur only once
Edited by Brad King