Use target_sources for INTERFACE libraries to be compatible with older CMake versions.

This commit is contained in:
asuessenbach 2023-10-09 14:22:54 +02:00
parent 7b8f30221a
commit 86c208b5e4

View File

@ -115,7 +115,8 @@ function( vulkan_hpp__setup_library )
vulkan_hpp__setup_project( NAME ${TARGET_NAME} ) vulkan_hpp__setup_project( NAME ${TARGET_NAME} )
if( "${TARGET_SOURCES}" STREQUAL "" ) if( "${TARGET_SOURCES}" STREQUAL "" )
add_library( ${TARGET_NAME} INTERFACE ${TARGET_HEADERS} ) add_library( ${TARGET_NAME} INTERFACE )
target_sources( ${TARGET_NAME} PUBLIC ${TARGET_HEADERS} )
else() else()
if( ${TARGET_SHARED} ) if( ${TARGET_SHARED} )
add_library( ${TARGET_NAME} SHARED ${TARGET_SOURCES} ${TARGET_HEADERS} ) add_library( ${TARGET_NAME} SHARED ${TARGET_SOURCES} ${TARGET_HEADERS} )