I wrote:
> David Cole wrote:

> > I am not sure I like this patch, or not. I'm on the fence.
> > 
> > I would recommend just using:
> >   ExternalProject_Add(xyz ...)
> >   add_dependencies(xyz mylib)
> > 
> > to add non-ExternalProject dependencies. Just to make it clear that the
> > dependencies are target-level dependencies and not file dependencies.
> 
> This only "sort-of" works. If I delete the library from the build try
> (only the .so) and rebuild the external project does not get relinked.
> Also the documentation of ExternalProject_Add says:
> 
>   [DEPENDS projects...]       # Targets on which the project depends
> 
> No word that these need to be file-level dependencies. In fact since
> ExternalProject.cmake unconditionally uses the _EP_STAMP_DIR property of
> the target this will only work with ExternalProject targets at all (not
> even file level dependencies) which looks just wrong to me.

Here is the patch in case you are going to apply it.

Eike
>From 788e6ca699ad1f48fbfa20d8d9d715b3fc732e46 Mon Sep 17 00:00:00 2001
From: Rolf Eike Beer <[email protected]>
Date: Mon, 28 Mar 2011 23:21:14 +0200
Subject: [PATCH] ExternalProject: make DEPENDS work with "normal" targets

ExternalProject_Add currently expects it's dependencies to have the property
_EP_STAMP_DIR set which is only true for other targets created by it. Now
it is first checked if that property is actually present and is only taken
as generated by ExternalProject if it does.
---
 Modules/ExternalProject.cmake |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 390b8f9..1aecbfa 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1266,8 +1266,14 @@ function(_ep_add_configure_command name)
   set(file_deps)
   get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
   foreach(dep IN LISTS deps)
+    # Find out if this dependency is itself an external target or not.
+    # If it doesn't have _EP_STAMP_DIR we assume it's a normal target.
     get_property(dep_stamp_dir TARGET ${dep} PROPERTY _EP_STAMP_DIR)
-    list(APPEND file_deps ${dep_stamp_dir}${cfgdir}/${dep}-done)
+    if(dep_stamp_dir)
+      list(APPEND file_deps ${dep_stamp_dir}${cfgdir}/${dep}-done)
+    else(dep_stamp_dir)
+      list(APPEND file_deps ${dep})
+    endif(dep_stamp_dir)
   endforeach()
 
   get_property(cmd_set TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND SET)
-- 
1.7.3.2

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to