CMake: check INTERFACE_LINK_LIBRARIES for empty value

This is a safety for consistency. It doesn't really change the result
but avoids "adding" an empty argument to a CMake list.
This commit is contained in:
Albrecht Schlosser 2025-01-21 14:23:27 +01:00
parent 2dd4bdeef7
commit 6c3a71181b

View File

@ -658,8 +658,10 @@ set(OPTIONAL_INCLUDES)
macro(append_optional_libs targets)
foreach(_target ${targets})
get_target_property(_link_libraries ${_target} INTERFACE_LINK_LIBRARIES)
if(_link_libraries)
list(APPEND OPTIONAL_LIBS ${_link_libraries})
endif()
get_target_property(_include_dirs ${_target} INTERFACE_INCLUDE_DIRECTORIES)
list(APPEND OPTIONAL_LIBS ${_link_libraries})
if(_include_dirs)
list(APPEND OPTIONAL_INCLUDES ${_include_dirs})
endif()