[CMake] Specifying path of nvcc for CUDA projects using project command

Robert Maynard robert.maynard at kitware.com
Mon Sep 10 17:21:43 EDT 2018


You can specify the location by setting the CUDACXX environment
variable ( https://cmake.org/cmake/help/v3.12/envvar/CUDACXX.html ).
On Mon, Sep 10, 2018 at 2:40 PM Jeffrey Perez via CMake <cmake at cmake.org> wrote:
>
> Hello,
>
>
>
> I have a project which uses the CMake 3.10.1 and CUDA nvcc compiler and I am using the new project(projectName LANGUAGES CUDA) instead of find_package(CUDA) to do so. I want CMake to use a different (explicitly defined) path for nvcc compiler than the installed version. Before calling project(projectName LANGUAGES CUDA), I declare CUDA_TOOLKIT_ROOT_DIR via an include of a file which defines our third party library variables, but it always finds the installed version. I know that CUDA_TOOLKIT_ROOT_DIR  was meant for the find_package(CUDA) script, but the documentation doesn't seem to specify how to use the new project method of including nvcc.
>
>
>
> Is there a way to specify a different nvcc location using the new format?
>
>
>
> Excerpt from CMakeLists.txt:
>
>>
> include(${CMAKE_CURRENT_SOURCE_DIR}/../../../build/thirdparty_versions.cmake) #defines CUDA_TOOLKIT_ROOT_DIR to specified CUDA root with bin/nvcc below it.
>
> message(---------------CUDA_TOOLKIT_ROOT_DIR:${ CUDA_TOOLKIT_ROOT_DIR})
> project(projectName LANGUAGES CUDA)
>
>>
>
>
> Below is a portion of my output:
>
>>
> ---------------CUDA_TOOLKIT_ROOT_DIR:C:/thirdparty/CUDA/v8.0
>
> -- Selecting Windows SDK version 10.0.14393.0 to target Windows 10.0.17134.
>
> -- The CUDA compiler identification is NVIDIA 8.0.44
>
> -- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/bin/nvcc.exe
>
>
>
> You can see that the CUDA compiler found was the intalled version, not C:/thirdparty/CUDA/v8.0
>
>
>
> Thanks,
>
> Jeff Perez
>
>
>
> -- WARNING - CONFIDENTIAL INFORMATION: The information contained in the e-mail may contain confidential and privileged information and is intended solely for the use of the intended recipient(s). Access for any review, re-transmission, dissemination or other use of, or taking of any action in regard and reliance upon this e-mail by persons or entities other than the intended recipient(s) is unauthorized and prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and any attachments.
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list