diff --git a/cmake/defaults/Packages.cmake b/cmake/defaults/Packages.cmake index d4eea2988..106fd15e2 100644 --- a/cmake/defaults/Packages.cmake +++ b/cmake/defaults/Packages.cmake @@ -196,7 +196,8 @@ if (PXR_BUILD_IMAGING) # --OpenImageIO if (PXR_BUILD_OPENIMAGEIO_PLUGIN) set(REQUIRES_Imath TRUE) - find_package(OpenImageIO REQUIRED) + find_package(OpenImageIO CONFIG REQUIRED) + set(OIIO_LIBRARIES OpenImageIO::OpenImageIO) add_definitions(-DPXR_OIIO_PLUGIN_ENABLED) if (OIIO_idiff_BINARY) set(IMAGE_DIFF_TOOL ${OIIO_idiff_BINARY} CACHE STRING "Uses idiff for image diffing") diff --git a/pxr/imaging/plugin/hioOiio/CMakeLists.txt b/pxr/imaging/plugin/hioOiio/CMakeLists.txt index 0a055b711..de4b73a47 100644 --- a/pxr/imaging/plugin/hioOiio/CMakeLists.txt +++ b/pxr/imaging/plugin/hioOiio/CMakeLists.txt @@ -7,6 +7,7 @@ if (NOT ${PXR_BUILD_GPU_SUPPORT}) return() endif() +if(0) # No need because OpenImageIO::OpenImageIO already declare its transitive dependencies correctly # Use the import targets set by Imath's package config if (Imath_FOUND) set(__OIIO_IMATH_LIBS "Imath::Imath") @@ -14,6 +15,7 @@ else() set(__OIIO_IMATH_INCLUDE ${OPENEXR_INCLUDE_DIRS}) set(__OIIO_IMATH_LIBS ${OPENEXR_LIBRARIES}) endif() +endif() pxr_plugin(hioOiio LIBRARIES diff --git a/pxr/pxrConfig.cmake.in b/pxr/pxrConfig.cmake.in index 692d045b9..a934c336b 100644 --- a/pxr/pxrConfig.cmake.in +++ b/pxr/pxrConfig.cmake.in @@ -22,6 +22,9 @@ find_dependency(TBB CONFIG) if(@PXR_BUILD_IMAGING@) find_dependency(OpenSubdiv 3 CONFIG) + if(@PXR_BUILD_OPENIMAGEIO_PLUGIN@) + find_dependency(OpenImageIO CONFIG) + endif() endif() # If Python support was enabled for this USD build, find the import @@ -79,7 +82,7 @@ if(@Imath_FOUND@) set(Imath_DIR [[@Imath_DIR@]]) endif() endif() - find_dependency(Imath) + find_dependency(Imath CONFIG) endif() include("${PXR_CMAKE_DIR}/cmake/pxrTargets.cmake")