summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2020-05-30 11:24:57 (GMT)
committerRaul Tambre <raul@tambre.ee>2020-06-12 18:50:05 (GMT)
commit0a056246a1839cbb89b72e8f1f65b583f33f794b (patch)
treeee8e73526c6f7c7bdfd637e10b6a02eb2f4addfc /Source/cmLocalGenerator.cxx
parent9c4397212721a2f18d31ac739d4c3ad9eebafada (diff)
downloadCMake-0a056246a1839cbb89b72e8f1f65b583f33f794b.zip
CMake-0a056246a1839cbb89b72e8f1f65b583f33f794b.tar.gz
CMake-0a056246a1839cbb89b72e8f1f65b583f33f794b.tar.bz2
CUDA: Pass toolkit path to Clang
Clang isn't very good at finding the installed CUDA toolkit. The upstream recommendation is that we should pass the toolkit explicitly. Additionally: * Avoids Clang having to search for the toolkit on every invocation. * Allows the user to use a toolkit from a non-standard location by simply setting CUDAToolkit_ROOT. The same way as with FindCUDAToolkit. Clang wants the directory containing the device library and version.txt as the toolkit path. We thus pass the newly introduced CUDAToolkit_LIBRARY_ROOT as the toolkit path. We save CUDAToolkit_ROOT_DIR and CUDAToolkit_LIBRARY_ROOT on Clang to have them available in try_compile() and avoid unnecessary re-searching or a possibly different installation being found in FindCUDAToolkit. This however means that the selected toolkit can't be changed after the initial language enablement. We now determine CUDA compiler ID before doing actual detection, as we don't want to spend time finding the CUDA toolkit for NVIDIA. Implements #20754.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx1
1 files changed, 1 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index fba9cdb..f748822 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1986,6 +1986,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
}
} else if (lang == "CUDA") {
target->AddCUDAArchitectureFlags(flags);
+ target->AddCUDAToolkitFlags(flags);
std::string const& compiler =
this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");