FindCUDA: Use find_program if find_host_program is not available

CMake does not define the `find_host_program` command we've been using
in the cross-compiling code path.  It was provided by a widely used
Android toolchain file.  For compatibility, continue to use
`find_host_program` if available, but otherwise use just `find_program`.

Fixes: #16509
This commit is contained in:
Maxime Roussin-Bélanger
2017-06-26 11:30:07 -04:00
committed by Brad King
parent 6c363f5caf
commit 46d25e782e

View File

@@ -679,7 +679,11 @@ if(CMAKE_CROSSCOMPILING)
# add known CUDA targetr root path to the set of directories we search for programs, libraries and headers
set( CMAKE_FIND_ROOT_PATH "${CUDA_TOOLKIT_TARGET_DIR};${CMAKE_FIND_ROOT_PATH}")
macro( cuda_find_host_program )
find_host_program( ${ARGN} )
if (COMMAND find_host_program)
find_host_program( ${ARGN} )
else()
find_program( ${ARGN} )
endif()
endmacro()
else()
# for non-cross-compile, find_host_program == find_program and CUDA_TOOLKIT_TARGET_DIR == CUDA_TOOLKIT_ROOT_DIR