In generated cmake config file for SPIRV-Tools only access cmake target, if present (#4590)

Fixes #4582
This commit is contained in:
Ralf Habacker 2021-10-29 20:05:45 +02:00 committed by GitHub
parent e3a373f2b7
commit e3c7098104
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -428,8 +428,10 @@ if(ENABLE_SPIRV_TOOLS_INSTALL)
# Special config file for root library compared to other libs.
file(WRITE ${CMAKE_BINARY_DIR}/${SPIRV_TOOLS}Config.cmake
"include(\${CMAKE_CURRENT_LIST_DIR}/${SPIRV_TOOLS}Target.cmake)\n"
"set(${SPIRV_TOOLS}_LIBRARIES ${SPIRV_TOOLS})\n"
"get_target_property(${SPIRV_TOOLS}_INCLUDE_DIRS ${SPIRV_TOOLS} INTERFACE_INCLUDE_DIRECTORIES)\n")
"if(TARGET ${SPIRV_TOOLS})\n"
" set(${SPIRV_TOOLS}_LIBRARIES ${SPIRV_TOOLS})\n"
" get_target_property(${SPIRV_TOOLS}_INCLUDE_DIRS ${SPIRV_TOOLS} INTERFACE_INCLUDE_DIRECTORIES)\n"
"endif()\n")
install(FILES ${CMAKE_BINARY_DIR}/${SPIRV_TOOLS}Config.cmake DESTINATION ${PACKAGE_DIR})
endif(ENABLE_SPIRV_TOOLS_INSTALL)