Handle install vs build include directories

Fix target_include_directories to appropriately handle build-tree and the install-tree.
This commit is contained in:
James Rumble
2019-08-06 15:29:31 +01:00
parent ab6d1499e1
commit c6f7294ced
8 changed files with 23 additions and 15 deletions

View File

@@ -46,7 +46,9 @@ endif(ENABLE_NV_EXTENSIONS)
add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
set_property(TARGET SPIRV PROPERTY FOLDER glslang)
set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
target_include_directories(SPIRV PUBLIC ..)
target_include_directories(SPIRV PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
if (ENABLE_SPVREMAPPER)
add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
@@ -67,7 +69,9 @@ if(ENABLE_OPT)
PRIVATE ${spirv-tools_SOURCE_DIR}/source
)
target_link_libraries(SPIRV glslang SPIRV-Tools-opt)
target_include_directories(SPIRV PUBLIC ../External)
target_include_directories(SPIRV PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
else()
target_link_libraries(SPIRV glslang)
endif(ENABLE_OPT)
@@ -97,8 +101,8 @@ if(ENABLE_GLSLANG_INSTALL)
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(EXPORT SPVRemapperTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT SPIRVTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT SPVRemapperTargets DESTINATION lib/cmake)
install(EXPORT SPIRVTargets DESTINATION lib/cmake)
install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/)
endif(ENABLE_GLSLANG_INSTALL)