MantisBT - CMake
View Issue Details
0010346CMakeModulespublic2010-02-28 13:062010-09-26 08:24
Alex Neundorf 
David Cole 
normalminoralways
closedfixed 
CMake-2-8 
CMake-2-8 
0010346: externalproject_add() does not work with only SOURCE_DIR given
If I want externalproject() to use the sources from an existing directory, according to the documentation I need to set only SOURCE_DIR.
But when I do so, I get
"error: no download info for HwLoc -- please specify existing SOURCE_DIR or one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY or DOWNLOAD_COMMAND"

The attached patch adds an else() branch for the case that SOURCE_DIR is set.
In this branch also cmd is set, otherwise cmake complains.
Also, it would be nice if in this case the directory DOWNLOAD_DIRECTORY would not be created.

Alex
No tags attached.
has duplicate 0010448closed David Cole ExternalProject_Add does not work with existing SOURCE_DIR 
patch externalproject.patch (748) 2010-02-28 13:06
https://public.kitware.com/Bug/file/2915/externalproject.patch
Issue History
2010-02-28 13:06Alex NeundorfNew Issue
2010-02-28 13:06Alex NeundorfFile Added: externalproject.patch
2010-02-28 13:06Alex NeundorfStatusnew => assigned
2010-02-28 13:06Alex NeundorfAssigned To => David Cole
2010-04-10 17:09Alex NeundorfNote Added: 0020122
2010-04-10 17:09Alex NeundorfSeveritymajor => minor
2010-04-13 14:41David ColeNote Added: 0020163
2010-04-13 15:10Alex NeundorfNote Added: 0020166
2010-04-19 11:51David ColeRelationship addedhas duplicate 0010448
2010-06-09 18:43David ColeNote Added: 0020960
2010-06-18 17:08David ColeNote Added: 0021093
2010-06-18 17:08David ColeStatusassigned => resolved
2010-06-18 17:08David ColeResolutionopen => fixed
2010-09-26 08:24Alex NeundorfNote Added: 0022350
2010-09-26 08:24Alex NeundorfStatusresolved => closed
2010-09-26 08:24Alex NeundorfFixed in Version => CMake-2-8

Notes
(0020122)
Alex Neundorf   
2010-04-10 17:09   
Dave, what do you think about the attached tiny patch ?
With the patch, if you already have a source dir, you can just specify it in externalproject_add() and don't have to explicitely set the DOWNLOAD_COMMAND empty.

If you think that's ok, I would commit it.

Alex
(0020163)
David Cole   
2010-04-13 14:41   
Please do *not* apply the attached patch, "externalproject.patch"!

The problem with the attached patch is that the variable "source_dir" is ALWAYS set, and the source directory "${source_dir}" ALWAYS exists, even if it has no content... because we actually create it at configure time, and at build time with make_directory and -E mkdir commands...

So, if we did take the attached patch, there would be no need for the else clause.

And people who do not specify anything will never see an error until build time.

But, really, the fix should be to see if there is a source_dir property set by the end user, as opposed to one that is set automatically by the logic in ExternalProject. The logic for determining this is a bit more complex... but I'll get to writing a fix eventaully.
(0020166)
Alex Neundorf   
2010-04-13 15:10   
Ok. If I find the time I'll have a look whether I can come up with a better patch.
If not, it's actually not a big deal.

Alex
(0020960)
David Cole   
2010-06-09 18:43   
I just pushed this commit to the 'next' branch:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cd3d60b8b5ae89b9c352b9ba022ae04ab97ea0e4 [^]

Please try it out if you get the chance and tell me if you see anything wrong with this approach.

Thanks,
Dave
(0021093)
David Cole   
2010-06-18 17:08   
The fix for this issue is included in CMake 2.8.2-rc2.
(0022350)
Alex Neundorf   
2010-09-26 08:24   
It was already resolved, close it.