0

I have several FetchContents Github repos in my CMakeLists.txt and they get reconfigured by CMake every time I modify my CMakeLists.txt:

FetchContent_Declare(fmt GIT_REPOSITORY https://github.com/fmtlib/fmt)
FetchContent_MakeAvailable(fmt)

FetchContent_Declare(glfw GIT_REPOSITORY https://github.com/glfw/glfw) 
FetchContent_MakeAvailable(glfw)

# Several more GitHub repositories using FetchContent
# ...

Is it possible to set FetchContent to skip the library that is already FetchContented?

afp_2008
  • 1,940
  • 1
  • 19
  • 46
  • 1
    No, you cannot tell CMake to not reconfigure a project added via `FetchContent` when the main project is modified. `FetchContent_MakeAvailable` is effectively `add_subdirectory` call, so `FetchContent`-ed project becomes **part of the main** project. If you want to build external project once, then use `ExternalProject_Add`. – Tsyvarev Jul 16 '22 at 18:06
  • Makes perfect sense. Thank you. – afp_2008 Jul 16 '22 at 20:27

0 Answers0