From 421e4be813e1ea96362c1fcf19be53cbdb631acd Mon Sep 17 00:00:00 2001 From: Rick Ratzel <3039903+rlratzel@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:52:39 -0500 Subject: [PATCH] Changed cuco cmake function to return early if cuco has already been added as a target (#1746) Changed cuco cmake function to return early if cuco has already been added as a target. This matches the technique used by raft [here](https://github.com/rapidsai/raft/blob/a3af3895410c19f3e713caa608ea2024f6008350/cpp/cmake/thirdparty/get_cuco.cmake#L19). Tested by doing a build and install of cuML, followed by a build of cuGraph and observing a CPM error about the alias target `cuco::cuco` already existing. Made the change to return early if cuco is already a target and observed the cuGraph `libcugraph.so` build succeed. Authors: - Rick Ratzel (https://github.com/rlratzel) Approvers: - Chuck Hastings (https://github.com/ChuckHastings) - Dillon Cullinan (https://github.com/dillon-cullinan) URL: https://github.com/rapidsai/cugraph/pull/1746 --- cpp/cmake/thirdparty/get_cuco.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cpp/cmake/thirdparty/get_cuco.cmake b/cpp/cmake/thirdparty/get_cuco.cmake index e49722b4823..7b9ab17bef6 100644 --- a/cpp/cmake/thirdparty/get_cuco.cmake +++ b/cpp/cmake/thirdparty/get_cuco.cmake @@ -16,6 +16,10 @@ function(find_and_configure_cuco VERSION) + if(TARGET cuco::cuco) + return() + endif() + rapids_cpm_find(cuco ${VERSION} GLOBAL_TARGETS cuco cuco::cuco CPM_ARGS @@ -26,9 +30,7 @@ function(find_and_configure_cuco VERSION) "BUILD_EXAMPLES OFF" ) - if(NOT TARGET cuco::cuco) - add_library(cuco::cuco ALIAS cuco) - endif() + add_library(cuco::cuco ALIAS cuco) endfunction()