find_package-stack: Exporting `Threads::Threads` and `CUDA::*` dependencies causes infinite hang
Given the following demo:
cmake_minimum_required(VERSION 3.18)
project(proj)
find_package(CUDAToolkit REQUIRED)
find_package(Threads REQUIRED)
add_library(demo STATIC f.cpp)
target_link_libraries(demo PRIVATE CUDA::cudart_static)
target_link_libraries(demo PRIVATE Threads::Threads)
install(TARGETS demo EXPORT mytargets)
install(EXPORT mytargets DESTINATION lib/cmake/ FILE mytargets.cmake)
export(EXPORT mytargets FILE mytargets.cmake)
The export(EXPORT)
and nstall(Export)
command hang. I presume the issue is that CMake has encountered a cycle ( CUDAToolkit
includes Threads
as well ) and fails to determine the subset of find calls needed.