diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake index f8cd9c1d61..4d6a401d49 100644 --- a/src/cmake/externalpackages.cmake +++ b/src/cmake/externalpackages.cmake @@ -352,7 +352,7 @@ macro (find_or_download_fmt) set (OIIO_USING_FMT_LOCAL TRUE) set (fmt_VERSION ${BUILD_FMT_VERSION}) else () - get_target_property(FMT_INCLUDE_DIR fmt::fmt INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(FMT_INCLUDE_DIR fmt::fmt-header-only INTERFACE_INCLUDE_DIRECTORIES) set (OIIO_USING_FMT_LOCAL FALSE) checked_find_package (fmt REQUIRED VERSION_MIN 7.0) diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt index 7dd17b8fd5..98ba2dc246 100644 --- a/src/include/CMakeLists.txt +++ b/src/include/CMakeLists.txt @@ -86,8 +86,7 @@ if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL) ${CMAKE_COMMAND} -E copy ${fmt_headers} ${fmt_internal_directory}) - add_custom_target (fmt_internal DEPENDS ${fmt_headers_internal}) - set(fmt_target fmt_internal) + add_custom_target (fmt_internal_target DEPENDS ${fmt_headers_internal}) else () set (fmt_headers ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/format.h @@ -102,7 +101,6 @@ else () file (WRITE "${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/std.h" "#include ") endif () - set(fmt_target fmt::fmt) endif () install (FILES ${fmt_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/detail/fmt diff --git a/src/libOpenImageIO/CMakeLists.txt b/src/libOpenImageIO/CMakeLists.txt index f194af6a87..472adeae10 100644 --- a/src/libOpenImageIO/CMakeLists.txt +++ b/src/libOpenImageIO/CMakeLists.txt @@ -143,7 +143,6 @@ target_link_libraries (OpenImageIO OpenImageIO_Util ${OPENIMAGEIO_IMATH_DEPENDENCY_VISIBILITY} ${OPENIMAGEIO_IMATH_TARGETS} - ${fmt_target} PRIVATE ${OPENIMAGEIO_OPENEXR_TARGETS} ${OpenCV_LIBRARIES} @@ -170,7 +169,12 @@ if (MINGW) target_link_libraries (OpenImageIO PRIVATE ws2_32) endif() - +if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL) + add_dependencies(OpenImageIO_Util fmt_internal_target) +else () + target_link_libraries (OpenImageIO_Util + PUBLIC fmt::fmt-header-only) +endif () file (GLOB iba_sources "imagebufalgo_*.cpp") if (MSVC) diff --git a/src/libutil/CMakeLists.txt b/src/libutil/CMakeLists.txt index 60a095c39e..f873b3eede 100644 --- a/src/libutil/CMakeLists.txt +++ b/src/libutil/CMakeLists.txt @@ -20,7 +20,6 @@ target_link_libraries (OpenImageIO_Util ${GCC_ATOMIC_LIBRARIES} ${OPENIMAGEIO_IMATH_DEPENDENCY_VISIBILITY} ${OPENIMAGEIO_IMATH_TARGETS} - ${fmt_target} PRIVATE $ $ @@ -28,11 +27,11 @@ target_link_libraries (OpenImageIO_Util ${CMAKE_DL_LIBS} ) -if (NOT OIIO_USING_FMT_LOCAL) - target_include_directories (OpenImageIO_Util - PUBLIC ${FMT_INCLUDES} ) +if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL) + add_dependencies(OpenImageIO_Util fmt_internal_target) +else () target_link_libraries (OpenImageIO_Util - PUBLIC $ ) + PUBLIC fmt::fmt-header-only) endif () if (WIN32)