Skip to content

Commit

Permalink
do copy in custom command
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Wójt <[email protected]>
  • Loading branch information
domin144 committed Dec 4, 2023
1 parent 3f29865 commit b726ace
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ macro (find_or_download_fmt)
set (FMT_INCLUDE_DIR "${FMT_INSTALL_DIR}/include")
set (OIIO_USING_FMT_LOCAL TRUE)
set (fmt_VERSION ${BUILD_FMT_VERSION})
add_library(fmt::fmt IMPORTED)
else ()
get_target_property(FMT_INCLUDE_DIR fmt::fmt INTERFACE_INCLUDE_DIRECTORIES)
set (OIIO_USING_FMT_LOCAL FALSE)
Expand Down
25 changes: 16 additions & 9 deletions src/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,24 @@ install (FILES ${detail_headers}
COMPONENT developer)

if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL)
set (fmt_headers
${FMT_INCLUDE_DIR}/fmt/core.h
${FMT_INCLUDE_DIR}/fmt/format-inl.h
${FMT_INCLUDE_DIR}/fmt/format.h
${FMT_INCLUDE_DIR}/fmt/ostream.h
${FMT_INCLUDE_DIR}/fmt/printf.h )
set (fmt_headers_base_names core.h format-inl.h format.h ostream.h printf.h)
if (fmt_VERSION VERSION_GREATER_EQUAL 9)
list (APPEND fmt_headers ${FMT_INCLUDE_DIR}/fmt/std.h)
list (APPEND fmt_headers_base_names std.h)
endif ()
file (COPY ${fmt_headers}
DESTINATION ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt)
list (TRANSFORM fmt_headers_base_names
PREPEND ${FMT_INCLUDE_DIR}/fmt/
OUTPUT_VARIABLE fmt_headers)
list (TRANSFORM fmt_headers_base_names
PREPEND ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/
OUTPUT_VARIABLE fmt_headers_internal)
add_custom_command (OUTPUT ${fmt_headers_internal}
DEPENDS ${fmt_headers}
COMMAND
${CMAKE_COMMAND} -E copy
${fmt_headers}
${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt)
add_custom_target (fmt_internal DEPENDS ${fmt_headers_internal})
add_dependencies (fmt::fmt fmt_internal)
else ()
set (fmt_headers
${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/format.h
Expand Down
1 change: 1 addition & 0 deletions src/libOpenImageIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ target_link_libraries (OpenImageIO
ZLIB::ZLIB
$<TARGET_NAME_IF_EXISTS:Boost::thread>
${CMAKE_DL_LIBS}
fmt::fmt
)

if (FREETYPE_FOUND)
Expand Down

0 comments on commit b726ace

Please sign in to comment.