Skip to content

Commit

Permalink
Remove Findfmt.cmake
Browse files Browse the repository at this point in the history
fmt provides a cmake config files since at least version 7.0.0,
which is the minimum version supported.
Fixed some variable names, so the provided config can be used.
  • Loading branch information
domin144 committed Dec 3, 2023
1 parent c098d7f commit db1bf0f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 44 deletions.
10 changes: 6 additions & 4 deletions src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ macro (find_or_download_fmt)
# If an external copy wasn't found and we requested that missing
# packages be built, or we we are forcing a local copy to be built, then
# download and build it.
if ((BUILD_MISSING_FMT AND NOT FMT_FOUND) OR BUILD_FMT_FORCE)
if ((BUILD_MISSING_FMT AND NOT fmt_FOUND) OR BUILD_FMT_FORCE)
message (STATUS "Downloading local fmtlib/fmt")
set (FMT_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/fmt")
set (FMT_GIT_REPOSITORY "https://github.com/fmtlib/fmt")
Expand All @@ -350,16 +350,18 @@ macro (find_or_download_fmt)
endif ()
set (FMT_INCLUDE_DIR "${FMT_INSTALL_DIR}/include")
set (OIIO_USING_FMT_LOCAL TRUE)
set (fmt_VERSION ${BUILD_FMT_VERSION})
else ()
get_target_property(FMT_INCLUDE_DIR fmt::fmt INTERFACE_INCLUDE_DIRECTORIES)
set (OIIO_USING_FMT_LOCAL FALSE)
checked_find_package (fmt REQUIRED
VERSION_MIN 7.0)
endif ()
checked_find_package (fmt REQUIRED
VERSION_MIN 7.0)
endmacro()

find_or_download_fmt()

if (FMT_VERSION VERSION_EQUAL 90100
if (fmt_VERSION VERSION_EQUAL 9.1.0
AND GCC_VERSION VERSION_GREATER 0.0 AND NOT GCC_VERSION VERSION_GREATER 7.2)
message (WARNING "${ColorRed}fmt 9.1 is known to not work with gcc <= 7.2${ColorReset}")
endif ()
32 changes: 0 additions & 32 deletions src/cmake/modules/Findfmt.cmake

This file was deleted.

16 changes: 8 additions & 8 deletions src/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ install (FILES ${detail_headers}

if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL)
set (fmt_headers
${FMT_INCLUDES}/fmt/core.h
${FMT_INCLUDES}/fmt/format-inl.h
${FMT_INCLUDES}/fmt/format.h
${FMT_INCLUDES}/fmt/ostream.h
${FMT_INCLUDES}/fmt/printf.h )
if (fmt_VERSION VERSION_GREATER_EQUAL 90000)
list (APPEND fmt_headers ${FMT_INCLUDES}/fmt/std.h)
${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 )
if (fmt_VERSION VERSION_GREATER_EQUAL 9)
list (APPEND fmt_headers ${FMT_INCLUDE_DIR}/fmt/std.h)
endif ()
file (COPY ${fmt_headers}
DESTINATION ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt)
Expand All @@ -85,7 +85,7 @@ else ()
file (WRITE "${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/${f}"
"#include <fmt/${f}>")
endforeach ()
if (fmt_VERSION VERSION_GREATER_EQUAL 90000)
if (fmt_VERSION VERSION_GREATER_EQUAL 9)
list (APPEND fmt_headers ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/std.h)
file (WRITE "${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/std.h"
"#include <fmt/std.h>")
Expand Down

0 comments on commit db1bf0f

Please sign in to comment.