vcpkg/ports/spirv-tools/CMake-targets.patch
2019-07-09 15:53:06 -04:00

92 lines
3.4 KiB
Diff

diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 1f96018..c9a3758 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -337,7 +337,7 @@ spvtools_pch(SPIRV_SOURCES pch_source)
add_library(${SPIRV_TOOLS} ${SPIRV_SOURCES})
spvtools_default_compile_options(${SPIRV_TOOLS})
target_include_directories(${SPIRV_TOOLS}
- PUBLIC ${spirv-tools_SOURCE_DIR}/include
+ PUBLIC "$<BUILD_INTERFACE:${spirv-tools_SOURCE_DIR}/include>"
PRIVATE ${spirv-tools_BINARY_DIR}
PRIVATE ${SPIRV_HEADER_INCLUDE_DIR}
)
@@ -370,10 +370,20 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
endif()
if(ENABLE_SPIRV_TOOLS_INSTALL)
- install(TARGETS ${SPIRV_TOOLS} ${SPIRV_TOOLS}-shared
+ install(TARGETS ${SPIRV_TOOLS} EXPORT spirv-tools-config
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ export(
+ TARGETS ${SPIRV_TOOLS}
+ NAMESPACE spirv-tools::
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/spirv-tools-config.cmake"
+ )
+ install(
+ EXPORT spirv-tools-config
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/share/spirv-tools"
+ NAMESPACE spirv-tools::
+ )
endif(ENABLE_SPIRV_TOOLS_INSTALL)
if(MSVC)
diff --git a/source/link/CMakeLists.txt b/source/link/CMakeLists.txt
index 8ca4df3..ac0aa62 100644
--- a/source/link/CMakeLists.txt
+++ b/source/link/CMakeLists.txt
@@ -17,7 +17,7 @@ add_library(SPIRV-Tools-link
spvtools_default_compile_options(SPIRV-Tools-link)
target_include_directories(SPIRV-Tools-link
- PUBLIC ${spirv-tools_SOURCE_DIR}/include
+ PUBLIC "$<BUILD_INTERFACE:${spirv-tools_SOURCE_DIR}/include>"
PUBLIC ${SPIRV_HEADER_INCLUDE_DIR}
PRIVATE ${spirv-tools_BINARY_DIR}
)
@@ -29,8 +29,13 @@ set_property(TARGET SPIRV-Tools-link PROPERTY FOLDER "SPIRV-Tools libraries")
spvtools_check_symbol_exports(SPIRV-Tools-link)
if(ENABLE_SPIRV_TOOLS_INSTALL)
- install(TARGETS SPIRV-Tools-link
+ install(TARGETS SPIRV-Tools-link EXPORT spirv-tools-config
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ export(
+ TARGETS ${SPIRV_TOOLS}-link
+ NAMESPACE spirv-tools::
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/spirv-tools-link-config.cmake"
+ )
endif(ENABLE_SPIRV_TOOLS_INSTALL)
diff --git a/source/opt/CMakeLists.txt b/source/opt/CMakeLists.txt
index b02485a..111ce3c 100644
--- a/source/opt/CMakeLists.txt
+++ b/source/opt/CMakeLists.txt
@@ -221,7 +221,7 @@ add_library(SPIRV-Tools-opt ${SPIRV_TOOLS_OPT_SOURCES})
spvtools_default_compile_options(SPIRV-Tools-opt)
target_include_directories(SPIRV-Tools-opt
- PUBLIC ${spirv-tools_SOURCE_DIR}/include
+ PUBLIC "$<BUILD_INTERFACE:${spirv-tools_SOURCE_DIR}/include>"
PUBLIC ${SPIRV_HEADER_INCLUDE_DIR}
PRIVATE ${spirv-tools_BINARY_DIR}
)
@@ -233,8 +233,13 @@ set_property(TARGET SPIRV-Tools-opt PROPERTY FOLDER "SPIRV-Tools libraries")
spvtools_check_symbol_exports(SPIRV-Tools-opt)
if(ENABLE_SPIRV_TOOLS_INSTALL)
- install(TARGETS SPIRV-Tools-opt
+ install(TARGETS SPIRV-Tools-opt EXPORT spirv-tools-config
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ export(
+ TARGETS ${SPIRV_TOOLS}-opt
+ NAMESPACE spirv-tools::
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/spirv-tools-opt-config.cmake"
+ )
endif(ENABLE_SPIRV_TOOLS_INSTALL)