From 1be0bcbb9b2f4fb2ce474847fddf708557c14e8d Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 27 Mar 2023 11:34:03 -0400 Subject: [PATCH 1/2] Only try to install python targets when not already found. Avoids errors when `legate_add_cpp_subdirectory` found a local version and therefore the python targets can't be added since they already exist --- cmake/legate_helper_functions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/legate_helper_functions.cmake b/cmake/legate_helper_functions.cmake index db269fa78..63e559214 100644 --- a/cmake/legate_helper_functions.cmake +++ b/cmake/legate_helper_functions.cmake @@ -182,7 +182,7 @@ function(legate_default_python_install target) message(FATAL_ERROR "Need EXPORT name for legate_default_python_install") endif() - if (SKBUILD) + if (SKBUILD AND NOT TARGET legate::${target}_python) add_library(${target}_python INTERFACE) add_library(legate::${target}_python ALIAS ${target}_python) target_link_libraries(${target}_python INTERFACE legate::core legate::${target}) From 7e82207686615dc9470ceb056747382afcb95de7 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 27 Mar 2023 11:35:52 -0400 Subject: [PATCH 2/2] When invoked from sk-build allow re-compilation Consider a project that looks like: ``` legate_add_cpp_subdirectory(cpp TARGET legate_user EXPORT legate_user-export) legate_default_python_install(legate_user EXPORT legate_user-export) ``` If invoked from an env that already has `legate_user` already installed we can't rebuild from source since we implicitly call `find_package(legate_user)` due to being in a scikit-build env. --- cmake/legate_helper_functions.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/legate_helper_functions.cmake b/cmake/legate_helper_functions.cmake index 63e559214..630ce98e4 100644 --- a/cmake/legate_helper_functions.cmake +++ b/cmake/legate_helper_functions.cmake @@ -202,7 +202,7 @@ function(legate_default_python_install target) endfunction() function(legate_add_cpp_subdirectory dir) - set(options) + set(options ALWAYS_BUILD) set(one_value_args EXPORT TARGET) set(multi_value_args) cmake_parse_arguments( @@ -230,7 +230,7 @@ function(legate_add_cpp_subdirectory dir) BUILD_EXPORT_SET ${LEGATE_OPT_EXPORT} INSTALL_EXPORT_SET ${LEGATE_OPT_EXPORT}) - if (SKBUILD) + if (SKBUILD AND NOT LEGATE_OPT_ALWAYS_BUILD) if (NOT DEFINED ${target}_ROOT) set(${target}_ROOT ${CMAKE_SOURCE_DIR}/build) endif()