[CMake] Prevent ExternalProject from updating git submodules

Tim Gallagher tim.gallagher at gatech.edu
Fri Mar 13 13:32:56 EDT 2015


Okay, well, I hacked it so it would work for me: 

Our code requires a step between cloning and the submodule initalization. All of our code is hosted on a server behind a firewall, so when we are on our network the URL's for the submodules work great. But outside our network, git hardcodes the server names in the submodule URLs so we have a script to see what URL the clone came from and then changes all of the submodule URL's to use that same server. Outside our network, we build an SSH tunnel in and clone through a port forward to our server, so the .gitmodules file needs modified to set that up. 

Anyway, to make the ExternalProject work for me, I had to delete the submodule init section of the clone script. 

Then I could add an extra step between "download" and "update" to run our name-mangling script. 

I also modified the update step in ExternalProject so instead of running "git submodule update --recursive" it now runs "git submodule update --init --recursive" 

I don't know if anybody else has a similar use case as I do so maybe upstream changes are not needed. However, I will say that all of our codes have submodules in them that are not needed for the code to compile -- they are things like documentation or developer scripts/tools -- and so checking them out should be completely optional. It would be good if there was a way to not run the submodule init/update at all during the download or update steps, my odd use case notwithstanding. 

Tim 
----- Original Message -----

From: "Tim Gallagher" <tim.gallagher at gatech.edu> 
To: "cmake" <cmake at cmake.org> 
Sent: Friday, March 13, 2015 1:05:42 PM 
Subject: Re: [CMake] Prevent ExternalProject from updating git submodules 


Hi Nicholas, 

I tried that and no luck. I've done both: 

ExternalProject_Add(... GIT_SUBMODULES "") 

and 

set(empty_list "") 
ExternalProject_Add(... GIT_SUBMODULES "${empty_list}") 

and it still tries to update the submodules. I know it's seeing the option -- if I pass in a name of a submodule that doesn't exist, it will crash when it tries to check out that made up one. But I can't seem to get it to not update any of them. 

Tim 

----- Original Message -----

From: "Nicholas Yue" <yue.nicholas at gmail.com> 
To: "tim gallagher" <tim.gallagher at gatech.edu> 
Sent: Friday, March 13, 2015 12:52:41 PM 
Subject: Re: [CMake] Prevent ExternalProject from updating git submodules 


Hi Tim, 


I use external project but not the GIT_SUBMODULES but maybe the following might work 


(1) Create an empty list 
(2) set GIT_SUBMODULES to that empty list 


Cheers 


On 13 March 2015 at 09:43, Tim Gallagher < tim.gallagher at gatech.edu > wrote: 


Hi everybody, 

I'm plugging away at using the ExternalProject features to package up our code. Looking at the documentation for ExternalProject_Add, it says: 

... 
[GIT_SUBMODULES modules...] # Git submodules that shall be updated, all if empty 
... 

which is cool, but what do I do if I don't want any submodules updated at all? It seems my only choices are: 

1. Update them all (leaving GIT_SUBMODULES empty) 
2. Update some of them (set GIT_SUBMODULES to a list to update) 

but there's no 3rd option of not updating them at all. 

Any advice on how to keep it from updating any submodules? 

Thanks, 

Tim 
-- 

Powered by www.kitware.com 

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ 

Kitware offers various services to support the CMake community. For more information on each offering, please visit: 

CMake Support: http://cmake.org/cmake/help/support.html 
CMake Consulting: http://cmake.org/cmake/help/consulting.html 
CMake Training Courses: http://cmake.org/cmake/help/training.html 

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html 

Follow this link to subscribe/unsubscribe: 
http://public.kitware.com/mailman/listinfo/cmake 






-- 


Nicholas Yue 
Graphics - Arnold, Alembic, RenderMan, OpenGL, HDF5 
Custom Dev - C++ porting, OSX, Linux, Windows 
http://au.linkedin.com/in/nicholasyue 
https://vimeo.com/channels/naiadtools 


-- 

Powered by www.kitware.com 

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ 

Kitware offers various services to support the CMake community. For more information on each offering, please visit: 

CMake Support: http://cmake.org/cmake/help/support.html 
CMake Consulting: http://cmake.org/cmake/help/consulting.html 
CMake Training Courses: http://cmake.org/cmake/help/training.html 

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html 

Follow this link to subscribe/unsubscribe: 
http://public.kitware.com/mailman/listinfo/cmake 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150313/6b76e6e7/attachment.html>


More information about the CMake mailing list