From 7ec6f1c6fdf8a7d3787f8356ea1ccab050d40fd8 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 20 Jul 2022 16:09:55 -0400 Subject: [PATCH 1/2] Remove usage of find_path to locate cub/version.cuh When a consumer of cub uses the CMake `FIND_ROOT_PATH_MODE_INCLUDE` option it will cause all find_path searches to only occur under the find root path. Since this normally doesn't include the source files, it means that cub-header-search.cmake will fail to find the cub/version.cuh file. This issue was found when using conda-build on a project that includes cub, since conda-build sets up a cross compilation enviornment including a find root path. --- cub/cmake/cub-header-search.cmake | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cub/cmake/cub-header-search.cmake b/cub/cmake/cub-header-search.cmake index 2ff1a8acd8..d2d27b0a44 100644 --- a/cub/cmake/cub-header-search.cmake +++ b/cub/cmake/cub-header-search.cmake @@ -1,7 +1,7 @@ -unset(_CUB_VERSION_INCLUDE_DIR CACHE) # Clear old result to force search -find_path(_CUB_VERSION_INCLUDE_DIR cub/version.cuh - NO_DEFAULT_PATH # Only search explicit paths below: - PATHS - "${CMAKE_CURRENT_LIST_DIR}/../.." # Source tree -) -set_property(CACHE _CUB_VERSION_INCLUDE_DIR PROPERTY TYPE INTERNAL) +# Parse version information from version.h in source tree + # Source tree +set(_CUB_VERSION_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../..") +if(EXISTS "${_CUB_VERSION_INCLUDE_DIR}/cub/version.cuh") + set(_CUB_VERSION_INCLUDE_DIR "${_CUB_VERSION_INCLUDE_DIR}" CACHE FILEPATH "" FORCE) # Clear old result + set_property(CACHE _CUB_VERSION_INCLUDE_DIR PROPERTY TYPE INTERNAL) +endif() From ea6a8c2ce4e20cc93920cb05ae8e968eff37d28c Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 20 Jul 2022 21:39:10 -0400 Subject: [PATCH 2/2] Update cub/cmake/cub-header-search.cmake Co-authored-by: Allison Vacanti --- cub/cmake/cub-header-search.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cub/cmake/cub-header-search.cmake b/cub/cmake/cub-header-search.cmake index d2d27b0a44..47ac7e605b 100644 --- a/cub/cmake/cub-header-search.cmake +++ b/cub/cmake/cub-header-search.cmake @@ -1,5 +1,4 @@ # Parse version information from version.h in source tree - # Source tree set(_CUB_VERSION_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../..") if(EXISTS "${_CUB_VERSION_INCLUDE_DIR}/cub/version.cuh") set(_CUB_VERSION_INCLUDE_DIR "${_CUB_VERSION_INCLUDE_DIR}" CACHE FILEPATH "" FORCE) # Clear old result