[CMake] How to depend on an ExternalProject

Michael Wild themiwi at gmail.com
Fri Oct 8 06:50:05 EDT 2010


On 8. Oct, 2010, at 12:13 , Rolf Eike Beer wrote:

>> 
>> On 8. Oct, 2010, at 10:50 , Rolf Eike Beer wrote:
>> 
>>> Hi,
>>> 
>>> I have a problem with ExternalProject and how to depend on that. I'm not
>>> absolutely sure I got the CMakeLists.txt right, so I first ask here
>>> before
>>> filing a bug report.
>>> 
>>> The idea is like this: we have an project that generates a couple of
>>> files. In a special configuration of another project we need those files
>>> as input for a special build step. Those step will take those files,
>>> mangle them and will generate a source file at the end. This is then
>>> added
>>> as usual to a library (in my example below to a executable, but that
>>> doesn't matter). When I run the example below I get:
>>> 
>>> [ 80%] Built target Subdir_Build
>>> make[2]: *** No rule to make target `Subdir_Build', needed by `main.c'.
>>> Stop.
> 
> [...]
> 
>> Subdir_Build is a top-level target, and the custom-command can only depend
>> on files. You need to add a custom target that depends on main.c and then
>> add a dependency of that custom target on Subdir_Build.
> 
> The documentation of add_custom_command has this sentence:
> 
> If DEPENDS specifies any target (created by an ADD_* command) a
> target-level dependency is created to make sure the target is built
> before any target using this custom command.
> 
> So if I can't depend on a target this is extremely confusing. Even worse:
> the dependency itself _works_, i.e. Subdir_Build always get's properly
> build before the depending target. But even then depending target fails.
> 
> Eike

Does it work with the custom target? Because that's how it works for me. But I agree that either the documentation is wrong or there is a bug...

Michael

--
There is always a well-known solution to every human problem -- neat, plausible, and wrong.
H. L. Mencken

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101008/c7943dd4/attachment.pgp>


More information about the CMake mailing list