Skip to content

Commit 49d4076

Browse files
committed
fix: use fmt from c++
1 parent 2ab7bb8 commit 49d4076

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

cmake/Dependencies.cmake

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,31 +1585,24 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE)
15851585
# @EUGO_CHANGE - ability to use system fmt from c++ ....uhhh but will this try to pick up the c++ version?
15861586
if(NOT TARGET fmt)
15871587
if(USE_SYSTEM_FMT)
1588-
if (FMT_INCLUDE_DIR)
1589-
message(STATUS "Using FMT specified at ${FMT_INCLUDE_DIR}.")
1590-
list(APPEND CMAKE_PREFIX_PATH ${FMT_INCLUDE_DIR})
1591-
endif()
1592-
find_package(fmt)
1593-
if(NOT fmt_FOUND)
1594-
message(FATAL_ERROR "Cannot find System libfmt")
1595-
endif()
1596-
message(STATUS "-- Found System FMT: ${fmt_DIR}")
1588+
message(STATUS "Using std::format from c++ instead of bundlied fmt library.")
15971589
else()
1598-
message(STATUS "Using third party subdirectory fmt.")
1590+
message(STATUS "Using third party bundled fmt.")
15991591
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt)
1592+
# Disable compiler feature checks for `fmt`.
1593+
#
1594+
# CMake compiles a little program to check compiler features. Some of our build
1595+
# configurations (notably the mobile build analyzer) will populate
1596+
# CMAKE_CXX_FLAGS in ways that break feature checks. Since we already know
1597+
# `fmt` is compatible with a superset of the compilers that PyTorch is, it
1598+
# shouldn't be too bad to just disable the checks.
1599+
set_target_properties(fmt-header-only PROPERTIES INTERFACE_COMPILE_FEATURES "")
1600+
1601+
list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only)
16001602
endif()
16011603
endif()
16021604

1603-
# Disable compiler feature checks for `fmt`.
1604-
#
1605-
# CMake compiles a little program to check compiler features. Some of our build
1606-
# configurations (notably the mobile build analyzer) will populate
1607-
# CMAKE_CXX_FLAGS in ways that break feature checks. Since we already know
1608-
# `fmt` is compatible with a superset of the compilers that PyTorch is, it
1609-
# shouldn't be too bad to just disable the checks.
1610-
set_target_properties(fmt-header-only PROPERTIES INTERFACE_COMPILE_FEATURES "")
1611-
1612-
list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only)
1605+
16131606
set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE)
16141607

16151608
# ---[ Kineto

0 commit comments

Comments
 (0)