Add unified glslang CMake config collecting glslang-targets targets (#2989)

This commit is contained in:
MACHIZAUD Andréa
2022-08-03 02:16:03 +02:00
committed by GitHub
parent f28022c9f9
commit fb64704060
9 changed files with 188 additions and 72 deletions

View File

@@ -42,7 +42,18 @@ if(WIN32)
endif(WIN32)
if(ENABLE_GLSLANG_INSTALL)
install(TARGETS OGLCompiler EXPORT OGLCompilerTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT OGLCompilerTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
install(TARGETS OGLCompiler EXPORT glslang-targets)
# Backward compatibility
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/OGLCompilerTargets.cmake" "
message(WARNING \"Using `OGLCompilerTargets.cmake` is deprecated: use `find_package(glslang)` to find glslang CMake targets.\")
if (NOT TARGET glslang::OGLCompiler)
include(\"\${CMAKE_CURRENT_LIST_DIR}/../../${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/glslang-targets.cmake\")
endif()
add_library(OGLCompiler ALIAS glslang::OGLCompiler)
")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/OGLCompilerTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
endif(ENABLE_GLSLANG_INSTALL)