diff options
author | Brad King <brad.king@kitware.com> | 2020-06-15 13:25:11 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-06-15 13:25:29 (GMT) |
commit | 5d710f2d11ff949a83edeef5e102bad93aee1d37 (patch) | |
tree | 5250761adab1a8d2568aa89b73dde8bbd0200501 /Source/cmGeneratorTarget.cxx | |
parent | b9f171cbf21819b94f01d98b4da5cb20f31e7c1c (diff) | |
parent | ec59fb6c315f2797e72cab985110555c63ba65f8 (diff) | |
download | CMake-5d710f2d11ff949a83edeef5e102bad93aee1d37.zip CMake-5d710f2d11ff949a83edeef5e102bad93aee1d37.tar.gz CMake-5d710f2d11ff949a83edeef5e102bad93aee1d37.tar.bz2 |
Merge topic 'cuda_clang_toolkit_path'
ec59fb6c31 CUDA: Determine CUDA toolkit location for NVCC
0a056246a1 CUDA: Pass toolkit path to Clang
9c43972127 FindCUDAToolkit: Avoid unnecessary temporary variable computing binary dir
9eebb5b8b2 FindCUDAToolkit: Remove unnecessary checks around searches
8f01fe7bf1 FindCUDAToolkit: Use list(SORT) to sort in natural order
8c144fe9ad FindCUDAToolkit: Compute CUDAToolkit_INCLUDE_DIR instead of searching
403f8d31e3 FindCUDAToolkit: Add CUDAToolkit_LIBRARY_ROOT
6636693134 FindCUDAToolkit: Re-unify with Internal/CUDAToolkit
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4828
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 54d34ba..f2011ee 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -37,6 +37,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmMessageType.h" +#include "cmOutputConverter.h" #include "cmPropertyMap.h" #include "cmRange.h" #include "cmSourceFile.h" @@ -3152,6 +3153,28 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const } } +void cmGeneratorTarget::AddCUDAToolkitFlags(std::string& flags) const +{ + std::string const& compiler = + this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID"); + + if (compiler == "Clang") { + // Pass CUDA toolkit explicitly to Clang. + // Clang's searching for the system CUDA toolkit isn't very good and it's + // expected the user will explicitly pass the toolkit path. + // This also avoids Clang having to search for the toolkit on every + // invocation. + std::string toolkitRoot = + this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_LIBRARY_ROOT"); + + if (!toolkitRoot.empty()) { + flags += " --cuda-path=" + + this->LocalGenerator->ConvertToOutputFormat(toolkitRoot, + cmOutputConverter::SHELL); + } + } +} + //---------------------------------------------------------------------------- std::string cmGeneratorTarget::GetFeatureSpecificLinkRuleVariable( std::string const& var, std::string const& lang, |