leezu edited a comment on issue #17293: [Build] Add a reasonable default for 
CMAKE_CUDA_COMPILER in *nix
URL: https://github.com/apache/incubator-mxnet/pull/17293#issuecomment-575337042
 
 
   @larroy, yes it's required to check the environment variables (both 
`CUDACXX` and `PATH`) first before "falling back" to some default path. But it 
may be hard to ensure everything is done compatible to "standard" cmake. So 
let's just rely on cmake to figure out if it can find nvcc by standard means. 
Then only if this fails, fall back to the path.
   
   Thus I suggest the following approach instead
   
   ``` cmake
     check_language(CUDA)
     if (NOT CMAKE_CUDA_COMPILER_LOADED AND UNIX AND EXISTS 
"/usr/local/cuda/bin/nvcc")
       set(CMAKE_CUDA_COMPILER "/usr/local/cuda/bin/nvcc")
     endif()
   ```
   
   It should be placed at the same position as the changes done in this PR.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to