Skip to content

Ensure the targets that Thrust creates are global. #1182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions lib/cmake/cccl/cccl-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ foreach(component IN LISTS components)
DEVICE_OPTION_DOC
"Device system for CCCL::Thrust target."
ADVANCED
GLOBAL
)
target_link_libraries(CCCL::CCCL INTERFACE CCCL::Thrust)
endif()
Expand Down
8 changes: 7 additions & 1 deletion thrust/thrust/cmake/thrust-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
# [HOST <default system>] # Optionally change the default backend
# [DEVICE <default system>] # Optionally change the default backend
# [ADVANCED] # Optionally mark options as advanced
# [GLOBAL] # Optionally mark the target as GLOBAL
# )
#
# # Use a custom TBB, CUB, and/or OMP
Expand Down Expand Up @@ -107,6 +108,7 @@ set(THRUST_VERSION_COUNT ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_COUNT} CACHE INTER
function(thrust_create_target target_name)
thrust_debug("Assembling target ${target_name}. Options: ${ARGN}" internal)
set(options
GLOBAL
ADVANCED
FROM_OPTIONS
IGNORE_CUB_VERSION_CHECK
Expand Down Expand Up @@ -180,7 +182,11 @@ function(thrust_create_target target_name)
# We can just create an INTERFACE IMPORTED target here instead of going
# through _thrust_declare_interface_alias as long as we aren't hanging any
# Thrust/CUB include paths directly on ${target_name}.
add_library(${target_name} INTERFACE IMPORTED)
set(TCT_AS_GLOBAL )
if (TCT_GLOBAL)
set(TCT_AS_GLOBAL GLOBAL)
endif()
add_library(${target_name} INTERFACE IMPORTED ${TCT_AS_GLOBAL})
target_link_libraries(${target_name}
INTERFACE
Thrust::${TCT_HOST}::Host
Expand Down