Fixed interface includes for cmake config

Added target include directories for the library targets
so that interface include directories are published with
the OpenSubdiv cmake config.

Also, removed a cmake version test which is no longer needed.

Fixes #1278
This commit is contained in:
David G Yu 2023-06-19 19:35:00 -07:00
parent afaee86641
commit 4576083cd0
2 changed files with 45 additions and 27 deletions

View File

@ -846,6 +846,7 @@ endmacro()
#-------------------------------------------------------------------------------
# Build targets
include(GNUInstallDirs)
# if you want to build examples against installed OpenSubdiv header files,
# use OPENSUBDIV_INCLUDE_DIR.
@ -887,34 +888,31 @@ if (NOT NO_DOC)
add_subdirectory(documentation)
endif()
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.2)
#
# CMake Config.
#
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
#
# CMake Config.
#
include(CMakePackageConfigHelpers)
set(OPENSUBDIV_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(OPENSUBDIV_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
configure_package_config_file(
configure_package_config_file(
opensubdiv-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/OpenSubdivConfig.cmake
INSTALL_DESTINATION ${OPENSUBDIV_CONFIG_PATH}
)
write_basic_package_version_file(
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/OpenSubdivConfigVersion.cmake
VERSION ${OSD_SONAME}
COMPATIBILITY SameMajorVersion
)
)
install(EXPORT opensubdiv-targets
install(EXPORT opensubdiv-targets
NAMESPACE OpenSubdiv::
FILE OpenSubdivTargets.cmake
DESTINATION ${OPENSUBDIV_CONFIG_PATH})
install(FILES
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/OpenSubdivConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/OpenSubdivConfigVersion.cmake
DESTINATION ${OPENSUBDIV_CONFIG_PATH}
)
endif()
)

View File

@ -141,6 +141,11 @@ if (NOT NO_LIB)
FOLDER "opensubdiv"
)
target_include_directories(osd_static_cpu
INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_link_libraries(osd_static_cpu
${PLATFORM_CPU_LIBRARIES}
)
@ -163,6 +168,11 @@ if (NOT NO_LIB)
EXPORT_NAME osdGPU_static
CLEAN_DIRECT_OUTPUT 1)
target_include_directories(osd_static_gpu
INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_link_libraries(osd_static_gpu
${PLATFORM_CPU_LIBRARIES} ${PLATFORM_GPU_LIBRARIES}
)
@ -204,6 +214,11 @@ if (NOT NO_LIB)
)
endif()
target_include_directories(osd_dynamic_cpu
INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_link_libraries(osd_dynamic_cpu
${PLATFORM_CPU_LIBRARIES}
)
@ -237,6 +252,11 @@ if (NOT NO_LIB)
)
endif()
target_include_directories(osd_dynamic_gpu
INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_link_libraries(osd_dynamic_gpu
osd_dynamic_cpu
${PLATFORM_CPU_LIBRARIES} ${PLATFORM_GPU_LIBRARIES}