Skip to content

Commit db1bf0f

Browse files
committed
Remove Findfmt.cmake
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.
1 parent c098d7f commit db1bf0f

File tree

3 files changed

+14
-44
lines changed

3 files changed

+14
-44
lines changed

src/cmake/externalpackages.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ macro (find_or_download_fmt)
332332
# If an external copy wasn't found and we requested that missing
333333
# packages be built, or we we are forcing a local copy to be built, then
334334
# download and build it.
335-
if ((BUILD_MISSING_FMT AND NOT FMT_FOUND) OR BUILD_FMT_FORCE)
335+
if ((BUILD_MISSING_FMT AND NOT fmt_FOUND) OR BUILD_FMT_FORCE)
336336
message (STATUS "Downloading local fmtlib/fmt")
337337
set (FMT_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/fmt")
338338
set (FMT_GIT_REPOSITORY "https://github.com/fmtlib/fmt")
@@ -350,16 +350,18 @@ macro (find_or_download_fmt)
350350
endif ()
351351
set (FMT_INCLUDE_DIR "${FMT_INSTALL_DIR}/include")
352352
set (OIIO_USING_FMT_LOCAL TRUE)
353+
set (fmt_VERSION ${BUILD_FMT_VERSION})
353354
else ()
355+
get_target_property(FMT_INCLUDE_DIR fmt::fmt INTERFACE_INCLUDE_DIRECTORIES)
354356
set (OIIO_USING_FMT_LOCAL FALSE)
357+
checked_find_package (fmt REQUIRED
358+
VERSION_MIN 7.0)
355359
endif ()
356-
checked_find_package (fmt REQUIRED
357-
VERSION_MIN 7.0)
358360
endmacro()
359361

360362
find_or_download_fmt()
361363

362-
if (FMT_VERSION VERSION_EQUAL 90100
364+
if (fmt_VERSION VERSION_EQUAL 9.1.0
363365
AND GCC_VERSION VERSION_GREATER 0.0 AND NOT GCC_VERSION VERSION_GREATER 7.2)
364366
message (WARNING "${ColorRed}fmt 9.1 is known to not work with gcc <= 7.2${ColorReset}")
365367
endif ()

src/cmake/modules/Findfmt.cmake

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/include/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ install (FILES ${detail_headers}
6666

6767
if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL)
6868
set (fmt_headers
69-
${FMT_INCLUDES}/fmt/core.h
70-
${FMT_INCLUDES}/fmt/format-inl.h
71-
${FMT_INCLUDES}/fmt/format.h
72-
${FMT_INCLUDES}/fmt/ostream.h
73-
${FMT_INCLUDES}/fmt/printf.h )
74-
if (fmt_VERSION VERSION_GREATER_EQUAL 90000)
75-
list (APPEND fmt_headers ${FMT_INCLUDES}/fmt/std.h)
69+
${FMT_INCLUDE_DIR}/fmt/core.h
70+
${FMT_INCLUDE_DIR}/fmt/format-inl.h
71+
${FMT_INCLUDE_DIR}/fmt/format.h
72+
${FMT_INCLUDE_DIR}/fmt/ostream.h
73+
${FMT_INCLUDE_DIR}/fmt/printf.h )
74+
if (fmt_VERSION VERSION_GREATER_EQUAL 9)
75+
list (APPEND fmt_headers ${FMT_INCLUDE_DIR}/fmt/std.h)
7676
endif ()
7777
file (COPY ${fmt_headers}
7878
DESTINATION ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt)
@@ -85,7 +85,7 @@ else ()
8585
file (WRITE "${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/${f}"
8686
"#include <fmt/${f}>")
8787
endforeach ()
88-
if (fmt_VERSION VERSION_GREATER_EQUAL 90000)
88+
if (fmt_VERSION VERSION_GREATER_EQUAL 9)
8989
list (APPEND fmt_headers ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/std.h)
9090
file (WRITE "${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/std.h"
9191
"#include <fmt/std.h>")

0 commit comments

Comments
 (0)