[CMake] how to fetch a git submodule for a build target?

hex hex7c3 at gmail.com
Tue May 7 17:41:57 EDT 2019


hello,
>
> I am using the following command to add a git submodule to an existing 
> repository:
>
>
> add_custom_command(OUTPUT fetch
>
>   COMMAND git submodule add https://github.com/user/repo.git
>
> )
>
> add_custom_target(new DEPENDS fetch)
>
>
> This is working as intended. Adding an already existing submodule to 
> the repo does not present any problem by git, as for my build system 
> though it results in an error and the build target fails.
>
>
> how can I make the build fail gracefully?
>
>
> thank you in advance
>


More information about the CMake mailing list