While the way you proposed in your own answer has the same effect, the actual option you might want to use for that is UPDATE_DISCONNECTED
.
From CMake's documentation, under the section Update/patch options:
UPDATE_DISCONNECTED <bool>
When enabled, this option causes the update step to be skipped. It does not, however, prevent the download step. The update step can still be added as a step target (see ExternalProject_Add_StepTargets()
) and called manually.
So your final thing could look like the following:
ExternalProject_Add( external_lib
# ...
UPDATE_DISCONNECTED True
)
If you go a bit further down the excerpt I quoted though, the documentation explicitly advises against doing this and recommends controlling the update behaviour through a directory variable EP_UPDATE_DISCONNECTED
, whose value is used as the default value for UPDATE_DISCONNECTED
.
This means you can keep your ExternalProject_Add
call free of the UPDATE_DISCONNECTED
option, and instead run your CMake command like so:
$ cmake .. -DEP_UPDATE_DISCONNECTED:BOOL=True
$ cmake --build . [your_options]