diff --git a/cmake/configure_options.cmake b/cmake/configure_options.cmake index 5340d5aacf..a32d57e66f 100644 --- a/cmake/configure_options.cmake +++ b/cmake/configure_options.cmake @@ -151,6 +151,13 @@ define_option(vt_build_tests "tests" "Build VT tests" ON empty_feature) define_option(vt_build_tools "tools" "Build VT tools" ON empty_feature) define_option(vt_build_examples "examples" "Build VT examples" ON empty_feature) +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) ########################################################################################################## diff --git a/cmake/load_bundled_libraries.cmake b/cmake/load_bundled_libraries.cmake index c2773a24ad..745d475049 100644 --- a/cmake/load_bundled_libraries.cmake +++ b/cmake/load_bundled_libraries.cmake @@ -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)