Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cpp/cmake/thirdparty/get_treelite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ function(find_and_configure_treelite)
list(APPEND TREELITE_LIBS treelite::treelite)
else()
list(APPEND TREELITE_LIBS treelite::treelite_static)
# Installed Treelite packages may only provide the shared library.
find_package(Treelite ${PKG_VERSION} QUIET CONFIG)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would cause CPM_Treelite_SOURCE to be ignored when an installed Treelite package provides treelite::treelite_static: the early find_package() call creates that target, so rapids_cpm_find() skips CPM rather than using the requested source checkout.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just set CPM_DOWNLOAD_Treelite to ON in the static branch and leave source selection to rapids_cpm_find()? That would avoid the early find_package() call, preserve CPM_Treelite_SOURCE, and handle shared-only Conda installations. I think always building Treelite from source when static linking is requested is a reasonable trade-off.

if(NOT TARGET treelite::treelite_static)
message(STATUS
"Downloading Treelite to use Treelite static lib; "
"current env only offers shared Treelite lib")
set(CPM_DOWNLOAD_Treelite ON)
endif()
endif()

rapids_cpm_find(Treelite ${PKG_VERSION}
Expand Down
Loading