From: Kefu Chai Date: Fri, 26 Jul 2019 07:35:59 +0000 (+0800) Subject: cmake/modules/Distutils: do not add ${name}-clone if already added X-Git-Tag: v15.1.0~2025^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de9a04027fea1fb526597d983eba9a0a1de6661d;p=ceph.git cmake/modules/Distutils: do not add ${name}-clone if already added 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 --- diff --git a/cmake/modules/Distutils.cmake b/cmake/modules/Distutils.cmake index d664fa814bd..3275fa51174 100644 --- a/cmake/modules/Distutils.cmake +++ b/cmake/modules/Distutils.cmake @@ -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})