[PATCH] ExternalProject: make DEPENDS work with "normal" targets

Rolf Eike Beer eike at sf-mail.de
Tue Nov 1 12:21:14 EDT 2011


ExternalProject_Add currently expects it's dependencies to have the property
_EP_STAMP_DIR set which is only true for other targets created by
ExternalProject_Add. 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 +++++++-
 Tests/ExternalProject/CMakeLists.txt |   17 +++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index a37771b..0af6cf9 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1275,8 +1275,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)
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index 4a542d7..19f91a1 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -111,6 +111,23 @@ ExternalProject_Add(${proj}
 )
 set_property(TARGET ${proj} PROPERTY FOLDER "")
 
+add_custom_target(EmptyTarget)
+
+set(proj DependsOnTarget)
+ExternalProject_Add(${proj}
+  BUILD_COMMAND ""
+  CMAKE_ARGS ""
+  CONFIGURE_COMMAND ""
+  DEPENDS "EmptyTarget"
+  DOWNLOAD_COMMAND ""
+  INSTALL_COMMAND ""
+  PATCH_COMMAND ""
+  STEP_TARGETS install
+  URL ""
+  URL_MD5 ""
+)
+set_property(TARGET ${proj} PROPERTY FOLDER "")
+
 
 # Local DIR:
 #
-- 
1.7.3.2


--nextPart3449485.CKYyJG15L4--

--nextPart1380614.zmg8gPRWWc
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)

iEYEABECAAYFAk6wMd4ACgkQXKSJPmm5/E4ZYwCfVJlZJtyTi+wZixoOo77l7MQt
CD0AnAqmQc7AeZOJdCm1LfgVGZ/DbHAj
=icBr
-----END PGP SIGNATURE-----

--nextPart1380614.zmg8gPRWWc--



More information about the cmake-developers mailing list