[CMake] How to avoid continuous download while using ExternalProjects

Michael Wild themiwi at gmail.com
Wed Feb 10 10:40:30 EST 2010


On 10. Feb, 2010, at 15:37 , Luigi Calori wrote:

> 
> Hi Michael:
> 
> They are more or less something like:
> 
> 
> ExternalProject_Add(
>   ${PACKAGE}
>   SOURCE_DIR ${BASE_SOURCE}/${PACKAGE}/src
>   BINARY_DIR ${BASE_BUILD}/${PACKAGE}/build
>   INSTALL_DIR ${CMAKE_INSTALL_PREFIX}

I don't think this is correct! The INSTALL_DIR should be IMHO in the build-tree. Otherwise the files will be installed into the system while building (which, apart from being very bad practice, might fail if the user doesn't have the rights to write in this location).

>   URL http://www.zlib.net/zlib-1.2.3.tar.gz
>   PATCH_COMMAND ${CMAKE_COMMAND} -E copy "${Package_Dir}/Patch/CMakeLists.txt" <SOURCE_DIR>/CMakeLists.txt
>   CMAKE_COMMAND ${CMAKE_COMMAND}
>   CMAKE_ARGS
>       ${Package_std_cmake_args}
> )
> 
> 
> The problem is that I do not know how to easily issue a re-build without a re-download:
> The steps are always done, even if there is something broken in the configure or build step, so if I just clean the whole project, the download happen again, even if the (patched)source dir is already there.

Does it also happen if you just re-build without the clean step? Probably the stamp files get removed by the clean... Usually it should not be necessary to do a "clean" when developing.

> 
> I am working in MSVC9, from the master project, a download is re-issued even whn I switch from debug to release (i think because stamp file are config dependent)

Hmm. Haven't tried using a multi-config IDE so far. Are the stamp-files in a configuration-specific subdirectory? What's the value of BASE_SOURCE?

> 
> Thanks in advance.
> 
> Luigi
> 
> 
> Michael Wild wrote:
>> On 10. Feb, 2010, at 14:57 , Luigi Calori wrote:
>> 
>>  
>>> I' m trying to develop a project for building several lib dependencies using ExternalProjectAdd
>>> 
>>> Is there a way to avoid re-download of upstream tar.gz while developing config flags?
>>> 
>>> ANY examples of ExternalProjectAdd would REALLY welcome
>>> 
>>> Thanks in advance.
>>> 
>>> Luigi
>>>    
>> 
>> That's strange, this doesn't happen in my projects...
>> 
>> Can you show an example of your ExternalProject_Add calls?
>> 
>> Michael
>> 
>>  
> 



More information about the CMake mailing list