Skip to content

Commit

Permalink
#2216: Add CMake option to enable using external fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobDomagala committed Nov 28, 2023
1 parent d537fd6 commit 9b7757d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
7 changes: 7 additions & 0 deletions cmake/configure_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ else()
set(vt_feature_cmake_ci_build "0")
endif()

option(vt_external_fmt "Build VT with external fmt" OFF)
if(${vt_external_fmt})
message(STATUS "Building vt with external fmt library")
else()
message(STATUS "Building vt with included fmt library")
endif()

list(POP_BACK CMAKE_MESSAGE_INDENT)

message(STATUS "CI_BUILD = ${vt_feature_cmake_ci_build}")
19 changes: 15 additions & 4 deletions cmake/load_bundled_libraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,21 @@ endif()
# CLI11 always included in the build
add_subdirectory(${PROJECT_LIB_DIR}/CLI)

# fmt always included in the build
set(FMT_LIBRARY fmt)
add_subdirectory(${PROJECT_LIB_DIR}/fmt)
set_darma_compiler_flags(${FMT_LIBRARY})
# use included fmt or external one
if(${vt_external_fmt})
# user should provide 'fmt_DIR' to CMake (unless fmt is installed in system libs)
if(${fmt_DIR})
message(STATUS "vt_external_fmt = ON. Using fmt located at ${fmt_DIR}")
else()
message(STATUS "vt_external_fmt = ON but ${fmt_DIR} is not provided.")
endif()
find_package(fmt REQUIRED)
else()
set(FMT_LIBRARY fmt)
add_subdirectory(${PROJECT_LIB_DIR}/fmt)
set_darma_compiler_flags(${FMT_LIBRARY})
endif()


# EngFormat-Cpp always included in the build
set(ENG_FORMAT_LIBRARY EngFormat-Cpp)
Expand Down

0 comments on commit 9b7757d

Please sign in to comment.