diff --git a/CMakeLists.txt b/CMakeLists.txt index dcb9c53484..30b5cabb16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ InitializeFreeCADBuildOptions() CheckInterModuleDependencies() FreeCADLibpackChecks() SetupDoxygen() +SetupLibFmt() if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER) SetupPython() SetupPCL() diff --git a/cMake/FreeCAD_Helpers/PrintFinalReport.cmake b/cMake/FreeCAD_Helpers/PrintFinalReport.cmake index cb59d7e15f..456bab9264 100644 --- a/cMake/FreeCAD_Helpers/PrintFinalReport.cmake +++ b/cMake/FreeCAD_Helpers/PrintFinalReport.cmake @@ -178,6 +178,7 @@ macro(PrintFinalReport) conditional(Doxygen DOXYGEN_FOUND "not found" "${DOXYGEN_VERSION} Language: ${DOXYGEN_LANGUAGE}") conditional(Coin3D_DOC COIN3D_DOC_FOUND "not found" ${COIN3D_DOC_PATH}) conditional(PYCXX ${PYCXX_FOUND} "not found" "${PYCXX_VERSION} Incl: ${PYCXX_INCLUDE_DIR} Src:${PYCXX_SOURCE_DIR}") + conditional(fmt ${fmt_FOUND} "${fmt_VERSION}" "Source located in ${fmt_SOURCE_DIR}") section_end() diff --git a/cMake/FreeCAD_Helpers/SetupLibFmt.cmake b/cMake/FreeCAD_Helpers/SetupLibFmt.cmake new file mode 100644 index 0000000000..167d5e96d2 --- /dev/null +++ b/cMake/FreeCAD_Helpers/SetupLibFmt.cmake @@ -0,0 +1,39 @@ +macro(SetupLibFmt) + + # This internet check idea is borrowed from: + # https://stackoverflow.com/questions/62214621/how-to-check-for-internet-connection-with-cmake-automatically-prevent-fails-if + + message(STATUS "Checking for connection to GitHub...") + if (WIN32) + set(ping_command "ping /n 1 /w 1000 github.com") + else() + set(ping_command "ping -c 1 -W 1000 github.com") + endif() + execute_process( + COMMAND ${ping_command} + RESULT_VARIABLE NO_CONNECTION + ) + if(NO_CONNECTION GREATER 0) + set(FETCHCONTENT_UPDATES_DISCONNECTED ON) + message(WARNING "NO INTERNET CONNECTION: Using disconnected mode for FetchContent updates") + else() + message(STATUS "GitHub connection established for FetchContent") + set(FETCHCONTENT_UPDATES_DISCONNECTED OFF) + endif() + + include(FetchContent) + FetchContent_Declare(fmt + GIT_REPOSITORY https://github.com/fmtlib/fmt + GIT_TAG 9.1.0 + ) + FetchContent_MakeAvailable(fmt) + set_target_properties(fmt PROPERTIES POSITION_INDEPENDENT_CODE ON) + if (${fmt_FOUND}) + message(STATUS "find_package() was used to locate the fmt version ${fmt_VERSION}") + elseif(${fmt_POPULATED}) + message(STATUS "fmt was downloaded using FetchContent into ${fmt_SOURCE_DIR}") + else() + message(ERROR "Failed to install the fmt library") + endif() + +endmacro() \ No newline at end of file diff --git a/src/App/CMakeLists.txt b/src/App/CMakeLists.txt index 1232bc2946..0301bd36ae 100644 --- a/src/App/CMakeLists.txt +++ b/src/App/CMakeLists.txt @@ -65,6 +65,7 @@ include_directories( set(FreeCADApp_LIBS FreeCADBase ${Boost_LIBRARIES} + fmt::fmt ) include_directories(