Skip to content

Instantly share code, notes, and snippets.

@robertmaynard
Created January 24, 2022 19:21
Show Gist options
  • Save robertmaynard/c6a784e7e78d318cba2ae1e71805c618 to your computer and use it in GitHub Desktop.
Save robertmaynard/c6a784e7e78d318cba2ae1e71805c618 to your computer and use it in GitHub Desktop.
mutliple thrust find_package bug
cmake_minimum_required(VERSION 3.20)
project(find_thrust)
file(DOWNLOAD https://github.com/NVIDIA/thrust/archive/refs/tags/1.12.0.tar.gz
${CMAKE_CURRENT_BINARY_DIR}/thrust-1.12.tar.gz)
file(DOWNLOAD https://github.com/NVIDIA/cub/archive/refs/tags/1.12.0.tar.gz
${CMAKE_CURRENT_BINARY_DIR}/cub-1.12.tar.gz)
file(DOWNLOAD https://github.com/NVIDIA/thrust/archive/refs/tags/1.15.0.tar.gz
${CMAKE_CURRENT_BINARY_DIR}/thrust-1.15.tar.gz)
file(DOWNLOAD https://github.com/NVIDIA/cub/archive/refs/tags/1.15.0.tar.gz
${CMAKE_CURRENT_BINARY_DIR}/cub-1.15.tar.gz)
file(ARCHIVE_EXTRACT INPUT ${CMAKE_CURRENT_BINARY_DIR}/thrust-1.12.tar.gz
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(ARCHIVE_EXTRACT INPUT ${CMAKE_CURRENT_BINARY_DIR}/cub-1.12.tar.gz
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/thrust-1.12.0/dependencies/)
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/thrust-1.12.0/dependencies/cub-1.12.0/
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/thrust-1.12.0/dependencies/cub/)
file(ARCHIVE_EXTRACT INPUT ${CMAKE_CURRENT_BINARY_DIR}/thrust-1.15.tar.gz
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(ARCHIVE_EXTRACT INPUT ${CMAKE_CURRENT_BINARY_DIR}/cub-1.15.tar.gz
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/thrust-1.15.0/dependencies)
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/thrust-1.15.0/dependencies/cub-1.15.0/
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/thrust-1.15.0/dependencies/cub/)
list(APPEND CMAKE_PREFIX_PATH
# ${CMAKE_CURRENT_BINARY_DIR}/thrust-1.12.0/thrust/cmake
${CMAKE_CURRENT_BINARY_DIR}/thrust-1.15.0/thrust/cmake)
find_package(Thrust REQUIRED)
thrust_create_target(A::Thrust)
find_package(Thrust 1.15 REQUIRED)
thrust_create_target(B::Thrust)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment