Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | From 46d25e782ebd9b6c50771b6f30433c58fae03a51 Mon Sep 17 00:00:00 2001 |
| 2 | From: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com> |
| 3 | Date: Mon, 26 Jun 2017 11:30:07 -0400 |
| 4 | Subject: [PATCH] cmake: Use find_program if find_host_program is not |
| 5 | available |
| 6 | |
| 7 | CMake does not define the `find_host_program` command we've been using |
| 8 | in the cross-compiling code path. It was provided by a widely used |
| 9 | Android toolchain file. For compatibility, continue to use |
| 10 | `find_host_program` if available, but otherwise use just `find_program`. |
| 11 | |
| 12 | Upstream-Status: Accepted |
| 13 | [https://gitlab.kitware.com/cmake/cmake/merge_requests/1009] |
| 14 | - Will be in 3.10 |
| 15 | |
| 16 | Signed-off-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com> |
| 17 | --- |
| 18 | Modules/FindCUDA.cmake | 6 +++++- |
| 19 | 1 file changed, 5 insertions(+), 1 deletion(-) |
| 20 | |
| 21 | diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake |
| 22 | index a4dca54..77ca351 100644 |
| 23 | --- a/Modules/FindCUDA.cmake |
| 24 | +++ b/Modules/FindCUDA.cmake |
| 25 | @@ -679,7 +679,11 @@ if(CMAKE_CROSSCOMPILING) |
| 26 | # add known CUDA targetr root path to the set of directories we search for programs, libraries and headers |
| 27 | set( CMAKE_FIND_ROOT_PATH "${CUDA_TOOLKIT_TARGET_DIR};${CMAKE_FIND_ROOT_PATH}") |
| 28 | macro( cuda_find_host_program ) |
| 29 | - find_host_program( ${ARGN} ) |
| 30 | + if (COMMAND find_host_program) |
| 31 | + find_host_program( ${ARGN} ) |
| 32 | + else() |
| 33 | + find_program( ${ARGN} ) |
| 34 | + endif() |
| 35 | endmacro() |
| 36 | else() |
| 37 | # for non-cross-compile, find_host_program == find_program and CUDA_TOOLKIT_TARGET_DIR == CUDA_TOOLKIT_ROOT_DIR |
| 38 | -- |
| 39 | 2.1.4 |
| 40 | |