Updated cmake config export paths and target names

The cmake config export paths are now more consistent
with other vfx platform projects.

The target names are now more consistent with existing
opensubdiv static and dynamic library names.
This commit is contained in:
David G Yu 2022-09-15 01:58:32 -07:00
parent 28e511af12
commit 3f054c7410
3 changed files with 24 additions and 10 deletions

View File

@ -861,24 +861,27 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.2)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(OPENSUBDIV_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
configure_package_config_file(
opensubdiv-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/opensubdiv-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
${CMAKE_CURRENT_BINARY_DIR}/OpenSubdivConfig.cmake
INSTALL_DESTINATION ${OPENSUBDIV_CONFIG_PATH}
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/opensubdiv-config-version.cmake
${CMAKE_CURRENT_BINARY_DIR}/OpenSubdivConfigVersion.cmake
VERSION ${OSD_SONAME}
COMPATIBILITY SameMajorVersion
)
install(EXPORT opensubdiv-targets
NAMESPACE OpenSubdiv::
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
FILE OpenSubdivTargets.cmake
DESTINATION ${OPENSUBDIV_CONFIG_PATH})
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/opensubdiv-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/opensubdiv-config-version.cmake
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
${CMAKE_CURRENT_BINARY_DIR}/OpenSubdivConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/OpenSubdivConfigVersion.cmake
DESTINATION ${OPENSUBDIV_CONFIG_PATH}
)
endif()

View File

@ -3,4 +3,4 @@
set_and_check(OpenSubdiv_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@")
set_and_check(OpenSubdiv_LIB_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@")
include("${CMAKE_CURRENT_LIST_DIR}/opensubdiv-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/OpenSubdivTargets.cmake")

View File

@ -137,6 +137,7 @@ if (NOT NO_LIB)
set_target_properties(osd_static_cpu
PROPERTIES
OUTPUT_NAME osdCPU
EXPORT_NAME osdCPU_static
CLEAN_DIRECT_OUTPUT 1
FOLDER "opensubdiv"
)
@ -157,7 +158,11 @@ if (NOT NO_LIB)
${OPENGL_LOADER_OBJS}
${CUDA_KERNEL_FILES}
)
set_target_properties(osd_static_gpu PROPERTIES OUTPUT_NAME osdGPU CLEAN_DIRECT_OUTPUT 1)
set_target_properties(osd_static_gpu
PROPERTIES
OUTPUT_NAME osdGPU
EXPORT_NAME osdGPU_static
CLEAN_DIRECT_OUTPUT 1)
target_link_libraries(osd_static_gpu
${PLATFORM_CPU_LIBRARIES} ${PLATFORM_GPU_LIBRARIES}
@ -186,6 +191,7 @@ if (NOT NO_LIB)
set_target_properties(osd_dynamic_cpu
PROPERTIES
OUTPUT_NAME osdCPU
EXPORT_NAME osdCPU
CLEAN_DIRECT_OUTPUT 1
SOVERSION ${OSD_SONAME}
)
@ -193,6 +199,7 @@ if (NOT NO_LIB)
set_target_properties(osd_dynamic_cpu
PROPERTIES
OUTPUT_NAME osdCPU
EXPORT_NAME osdCPU
CLEAN_DIRECT_OUTPUT 1
)
endif()
@ -217,6 +224,7 @@ if (NOT NO_LIB)
set_target_properties(osd_dynamic_gpu
PROPERTIES
OUTPUT_NAME osdGPU
EXPORT_NAME osdGPU
CLEAN_DIRECT_OUTPUT 1
SOVERSION ${OSD_SONAME}
)
@ -224,6 +232,7 @@ if (NOT NO_LIB)
set_target_properties(osd_dynamic_gpu
PROPERTIES
OUTPUT_NAME osdGPU
EXPORT_NAME osdGPU
CLEAN_DIRECT_OUTPUT 1
)
endif()
@ -288,6 +297,7 @@ if (NOT NO_LIB)
INSTALL_NAME_DIR "@rpath/OpenSubdiv.framework/OpenSubdiv"
INSTALL_RPATH "@executable_path/Frameworks;@loader_path/Frameworks"
OUTPUT_NAME OpenSubdiv_static
EXPORT_NAME OpenSubdiv_static
CLEAN_DIRECT_OUTPUT true
)
@ -336,6 +346,7 @@ if (NOT NO_LIB)
INSTALL_NAME_DIR "@rpath/OpenSubdiv.framework/OpenSubdiv"
INSTALL_RPATH "@executable_path/Frameworks;@loader_path/Frameworks"
OUTPUT_NAME OpenSubdiv
EXPORT_NAME OpenSubdiv
CLEAN_DIRECT_OUTPUT true
)