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(GNUInstallDirs)
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
set(OPENSUBDIV_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
configure_package_config_file( configure_package_config_file(
opensubdiv-config.cmake.in opensubdiv-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/opensubdiv-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/OpenSubdivConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME} INSTALL_DESTINATION ${OPENSUBDIV_CONFIG_PATH}
) )
write_basic_package_version_file( write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/opensubdiv-config-version.cmake ${CMAKE_CURRENT_BINARY_DIR}/OpenSubdivConfigVersion.cmake
VERSION ${OSD_SONAME} VERSION ${OSD_SONAME}
COMPATIBILITY SameMajorVersion COMPATIBILITY SameMajorVersion
) )
install(EXPORT opensubdiv-targets install(EXPORT opensubdiv-targets
NAMESPACE OpenSubdiv:: NAMESPACE OpenSubdiv::
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}) FILE OpenSubdivTargets.cmake
DESTINATION ${OPENSUBDIV_CONFIG_PATH})
install(FILES install(FILES
${CMAKE_CURRENT_BINARY_DIR}/opensubdiv-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/OpenSubdivConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/opensubdiv-config-version.cmake ${CMAKE_CURRENT_BINARY_DIR}/OpenSubdivConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME} DESTINATION ${OPENSUBDIV_CONFIG_PATH}
) )
endif() endif()

View File

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