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
No known key found for this signature in database
GPG Key ID: 30529E12F7B25BCC
8 changed files with 23 additions and 15 deletions

View File

@ -11,5 +11,5 @@ endif(WIN32)
if(ENABLE_GLSLANG_INSTALL)
install(TARGETS OGLCompiler EXPORT OGLCompilerTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT OGLCompilerTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT OGLCompilerTargets DESTINATION lib/cmake)
endif(ENABLE_GLSLANG_INSTALL)

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)

View File

@ -33,7 +33,9 @@ endif(WIN32)
target_link_libraries(glslangValidator ${LIBRARIES})
target_link_libraries(spirv-remap ${LIBRARIES})
target_include_directories(glslangValidator PUBLIC ../External)
target_include_directories(glslangValidator PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
if(WIN32)
source_group("Source" FILES ${SOURCES})
@ -46,12 +48,12 @@ if(ENABLE_GLSLANG_INSTALL)
install(TARGETS spirv-remap EXPORT spirv-remapTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(EXPORT glslangValidatorTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT spirv-remapTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT glslangValidatorTargets DESTINATION lib/cmake)
install(EXPORT spirv-remapTargets DESTINATION lib/cmake)
if(BUILD_SHARED_LIBS)
install(TARGETS glslang-default-resource-limits EXPORT glslang-default-resource-limitsTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT glslang-default-resource-limitsTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT glslang-default-resource-limitsTargets DESTINATION lib/cmake)
endif()
endif(ENABLE_GLSLANG_INSTALL)

View File

@ -86,7 +86,9 @@ add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${H
set_property(TARGET glslang PROPERTY FOLDER glslang)
set_property(TARGET glslang PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(glslang OGLCompiler OSDependent)
target_include_directories(glslang PUBLIC ..)
target_include_directories(glslang PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
if(WIN32 AND BUILD_SHARED_LIBS)
set_target_properties(glslang PROPERTIES PREFIX "")
@ -114,7 +116,7 @@ if(ENABLE_GLSLANG_INSTALL)
install(TARGETS glslang EXPORT glslangTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(EXPORT glslangTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT glslangTargets DESTINATION lib/cmake)
endif(ENABLE_GLSLANG_INSTALL)
if(ENABLE_GLSLANG_INSTALL)

View File

@ -22,5 +22,5 @@ endif()
if(ENABLE_GLSLANG_INSTALL)
install(TARGETS OSDependent EXPORT OSDependentTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT OSDependentTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT OSDependentTargets DESTINATION lib/cmake)
endif(ENABLE_GLSLANG_INSTALL)

View File

@ -17,5 +17,5 @@ endif(WIN32)
if(ENABLE_GLSLANG_INSTALL)
install(TARGETS OSDependent EXPORT OSDependentTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT OSDependentTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT OSDependentTargets DESTINATION lib/cmake)
endif(ENABLE_GLSLANG_INSTALL)

View File

@ -33,7 +33,7 @@ if(BUILD_TESTING)
if(ENABLE_GLSLANG_INSTALL)
install(TARGETS glslangtests EXPORT glslangtestsTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(EXPORT glslangtestsTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT glslangtestsTargets DESTINATION lib/cmake)
endif(ENABLE_GLSLANG_INSTALL)
set(GLSLANG_TEST_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../Test")

View File

@ -41,5 +41,5 @@ if(ENABLE_GLSLANG_INSTALL)
install(TARGETS HLSL EXPORT HLSLTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(EXPORT HLSLTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT HLSLTargets DESTINATION lib/cmake)
endif(ENABLE_GLSLANG_INSTALL)