diff options
author | Brad King <brad.king@kitware.com> | 2021-02-12 12:19:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-02-12 12:23:48 (GMT) |
commit | 9ea66b2d86ba0449c41357c172fdf54a91424dfc (patch) | |
tree | 5f873672ffeed8504267871fb0fec339f0ac2b1d /Modules/FindCUDAToolkit.cmake | |
parent | 36b0cc795850b73a1777ffc9bad435ce07e2c607 (diff) | |
download | CMake-9ea66b2d86ba0449c41357c172fdf54a91424dfc.zip CMake-9ea66b2d86ba0449c41357c172fdf54a91424dfc.tar.gz CMake-9ea66b2d86ba0449c41357c172fdf54a91424dfc.tar.bz2 |
CUDA: Capture all nvcc output when extracting toolkit root
Since commit fb2afef620 (CUDA: Support nvcc symlinking to ccache,
2021-01-07) and commit 3cef91a321 (CUDA: Always extract CUDA Toolkit
root from nvcc verbose output, 2021-02-03) we always run the command
`nvcc -v __cmake_determine_cuda` to look for the toolkit root in its
stderr. On Windows, that command may print to stdout instead, so
capture that as well.
Diffstat (limited to 'Modules/FindCUDAToolkit.cmake')
-rw-r--r-- | Modules/FindCUDAToolkit.cmake | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index 256c98f..de2b068 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -522,13 +522,14 @@ else() # If NVCC exists then invoke it to find the toolkit location. # This allows us to support wrapper scripts (e.g. ccache or colornvcc), CUDA Toolkit, # NVIDIA HPC SDK, and distro's splayed layouts - execute_process(COMMAND ${CUDAToolkit_NVCC_EXECUTABLE} "-v" "__cmake_determine_cuda" ERROR_VARIABLE NVCC_ERR) - if(NVCC_ERR MATCHES "TOP=([^\r\n]*)") + execute_process(COMMAND ${CUDAToolkit_NVCC_EXECUTABLE} "-v" "__cmake_determine_cuda" + OUTPUT_VARIABLE _CUDA_NVCC_OUT ERROR_VARIABLE _CUDA_NVCC_OUT) + if(_CUDA_NVCC_OUT MATCHES "TOP=([^\r\n]*)") get_filename_component(CUDAToolkit_BIN_DIR "${CMAKE_MATCH_1}/bin" ABSOLUTE) else() get_filename_component(CUDAToolkit_BIN_DIR "${CUDAToolkit_NVCC_EXECUTABLE}" DIRECTORY) endif() - unset(NVCC_ERR) + unset(_CUDA_NVCC_OUT) mark_as_advanced(CUDAToolkit_BIN_DIR) set(CUDAToolkit_BIN_DIR "${CUDAToolkit_BIN_DIR}" CACHE PATH "" FORCE) |