Skip to content

Commit

Permalink
Fix dependency in INTERNALIZE_FMT case
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Wójt <[email protected]>
  • Loading branch information
domin144 committed Jan 4, 2024
1 parent 528a0fa commit 2813308
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions src/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -102,7 +101,6 @@ else ()
file (WRITE "${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/std.h"
"#include <fmt/std.h>")
endif ()
set(fmt_target fmt::fmt)
endif ()
install (FILES ${fmt_headers}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/detail/fmt
Expand Down
8 changes: 6 additions & 2 deletions src/libOpenImageIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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)
Expand Down
9 changes: 4 additions & 5 deletions src/libutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ target_link_libraries (OpenImageIO_Util
${GCC_ATOMIC_LIBRARIES}
${OPENIMAGEIO_IMATH_DEPENDENCY_VISIBILITY}
${OPENIMAGEIO_IMATH_TARGETS}
${fmt_target}
PRIVATE
$<TARGET_NAME_IF_EXISTS:Boost::filesystem>
$<TARGET_NAME_IF_EXISTS:Boost::thread>
$<TARGET_NAME_IF_EXISTS:TBB::tbb>
${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 $<TARGET_NAME_IF_EXISTS:fmt::fmt> )
PUBLIC fmt::fmt-header-only)
endif ()

if (WIN32)
Expand Down

0 comments on commit 2813308

Please sign in to comment.