]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake/modules/Distutils: do not add ${name}-clone if already added 28915/head
authorKefu Chai <kchai@redhat.com>
Fri, 26 Jul 2019 07:35:59 +0000 (15:35 +0800)
committerSebastian Wagner <sebastian.wagner@suse.com>
Fri, 26 Jul 2019 10:11:25 +0000 (12:11 +0200)
if `distutils_install_module("foo" ...)` is called mutiple times with
different python version, `foo-clone` will be added multiple times as a
custom target. which is not allowed:

add_custom_target cannot create target "foo-clone" because another
target with the same name already exists.

Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/Distutils.cmake

index d664fa814bde8aa1a517ef3fb519221a16dd14fe..3275fa51174566baa545990a710eb0a99f019ed8 100644 (file)
@@ -11,8 +11,10 @@ function(distutils_install_module name)
         COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${src})
     endif()
   endforeach()
-  add_custom_target(${name}-clone ALL
-    DEPENDS ${py_clone})
+  if(NOT TARGET ${name}-clone)
+    add_custom_target(${name}-clone ALL
+      DEPENDS ${py_clone})
+  endif()
   cmake_parse_arguments(DU "" "INSTALL_SCRIPT;PYTHON_VERSION" "" ${ARGN})
   if(DU_PYTHON_VERSION)
     set(python_version ${DU_PYTHON_VERSION})