[cmake-developers] ExternalProject and git clone

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Wed Sep 11 05:48:49 EDT 2013


On 10/09/13 18:13, David Cole wrote:
> Comments:
> 
> 
> (1) Obviously, remove the "FIXME" and actually add the documentation 
> before merging this into CMake 'next'...


Of course :)
I was waiting to define the exact new behaviour before writing the
documentation



> (2) This won't work:
> +string(REGEX MATCH \"^\${abs_binary_dir}\" source_in_binary_dir 
> \"\${abs_source_dir}\")
> 
> If there are REGEX characters in the directory name.
> 
> We have a similar test in 
> CMake/Tests/CMakeTests/CheckSourceTreeTest.cmake.in, but it uses 
> STREQUAL, string lengths and SUBSTRING to test if it's an in-source 
> build. Something similar to that would work reliably even when REGEX 
> characters are in the directory name.

Right, I didn't consider that, thanks for pointing me to that file!



> (3) Here:
> +  if(NOT IS_DIRECTORY \"${source_dir}\")
> 
> Do you mean to test for the ".git" directory?

I am actually testing if this is a file... If a user has a file with the
same name of the source directory, perhaps he doesn't want it to be deleted.

That's also the reason why I want to check if the directory is not
empty. If you have a folder with the same name of the repository, and it
contains some file, perhaps you don't want to lose its content. (If it
is empty it was probably created previously by cmake, or anyway you
don't lose anything important)

But I just realized that it could be a symlink to a directory containing
the repository, stored somewhere else...

So should I support this?


> (4) The second time the "Repository URL is different" code is hit, 
> there will already be an "origin.old" remote. Does that mean the call 
> will fail with an error? Could you construct a unique name each time 
> through instead to avoid the error?

Good idea, I'll rename it to something like "origin+timestamp"



Thanks for the comments, I'll update the patch as soon as possible.


Cheers,
 Daniele



More information about the cmake-developers mailing list