summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio10Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-02-08 21:05:08 (GMT)
committerBrad King <brad.king@kitware.com>2017-03-10 15:19:53 (GMT)
commit5164e9a6510137eaac1c7b736a6b24fe02ce17a9 (patch)
treeef9e7554cb68377b3aebe09ae4e1265646f5f42c /Source/cmGlobalVisualStudio10Generator.cxx
parent83bf980c9601c2e5d6a6247867606539d8a14528 (diff)
downloadCMake-5164e9a6510137eaac1c7b736a6b24fe02ce17a9.zip
CMake-5164e9a6510137eaac1c7b736a6b24fe02ce17a9.tar.gz
CMake-5164e9a6510137eaac1c7b736a6b24fe02ce17a9.tar.bz2
VS: Provide an option to specify CUDA toolset version
The NVIDIA CUDA Toolkit provides MSBuild toolset files for integration with Visual Studio. Multiple versions may be installed so we need a way to tell our VS generators which CUDA toolset to use. Extend the `CMAKE_GENERATOR_TOOLSET` specification to provide a `cuda=...` field specifying the version number.
Diffstat (limited to 'Source/cmGlobalVisualStudio10Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx23
1 files changed, 21 insertions, 2 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 7f34e93..55babda 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -186,6 +186,9 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
if (const char* hostArch = this->GetPlatformToolsetHostArchitecture()) {
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE", hostArch);
}
+ if (const char* cuda = this->GetPlatformToolsetCuda()) {
+ mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_CUDA", cuda);
+ }
return true;
}
@@ -261,8 +264,10 @@ bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset(
bool cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField(
std::string const& key, std::string const& value)
{
- static_cast<void>(key);
- static_cast<void>(value);
+ if (key == "cuda") {
+ this->GeneratorToolsetCuda = value;
+ return true;
+ }
return false;
}
@@ -463,6 +468,20 @@ cmGlobalVisualStudio10Generator::GetPlatformToolsetHostArchitecture() const
return CM_NULLPTR;
}
+const char* cmGlobalVisualStudio10Generator::GetPlatformToolsetCuda() const
+{
+ if (!this->GeneratorToolsetCuda.empty()) {
+ return this->GeneratorToolsetCuda.c_str();
+ }
+ return CM_NULLPTR;
+}
+
+std::string const&
+cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaString() const
+{
+ return this->GeneratorToolsetCuda;
+}
+
bool cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf)
{
if (!this->cmGlobalVisualStudio8Generator::FindMakeProgram(mf)) {