summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudioGeneratorOptions.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmVisualStudioGeneratorOptions.cxx')
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx44
1 files changed, 27 insertions, 17 deletions
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 1139aa9..4004b66 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -3,6 +3,8 @@
#include <cm/iterator>
#include "cmAlgorithms.h"
+#include "cmGeneratorExpression.h"
+#include "cmGeneratorTarget.h"
#include "cmLocalVisualStudioGenerator.h"
#include "cmOutputConverter.h"
#include "cmSystemTools.h"
@@ -149,25 +151,33 @@ bool cmVisualStudioGeneratorOptions::UsingSBCS() const
return false;
}
-cmVisualStudioGeneratorOptions::CudaRuntime
-cmVisualStudioGeneratorOptions::GetCudaRuntime() const
+void cmVisualStudioGeneratorOptions::FixCudaRuntime(cmGeneratorTarget* target)
{
std::map<std::string, FlagValue>::const_iterator i =
this->FlagMap.find("CudaRuntime");
- if (i != this->FlagMap.end() && i->second.size() == 1) {
- std::string const& cudaRuntime = i->second[0];
- if (cudaRuntime == "Static") {
- return CudaRuntimeStatic;
- }
- if (cudaRuntime == "Shared") {
- return CudaRuntimeShared;
- }
- if (cudaRuntime == "None") {
- return CudaRuntimeNone;
+ if (i == this->FlagMap.end()) {
+ // User didn't provide am override so get the property value
+ const char* runtimeLibraryValue =
+ target->GetProperty("CUDA_RUNTIME_LIBRARY");
+ if (runtimeLibraryValue) {
+ std::string cudaRuntime =
+ cmSystemTools::UpperCase(cmGeneratorExpression::Evaluate(
+ runtimeLibraryValue, this->LocalGenerator, this->Configuration,
+ target));
+ if (cudaRuntime == "STATIC") {
+ this->AddFlag("CudaRuntime", "Static");
+ }
+ if (cudaRuntime == "SHARED") {
+ this->AddFlag("CudaRuntime", "Shared");
+ }
+ if (cudaRuntime == "NONE") {
+ this->AddFlag("CudaRuntime", "None");
+ }
+ } else {
+ // nvcc default is static
+ this->AddFlag("CudaRuntime", "Static");
}
}
- // nvcc default is static
- return CudaRuntimeStatic;
}
void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration()
@@ -431,7 +441,7 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions(
if (this->Defines.empty()) {
return;
}
- const char* tag = "PreprocessorDefinitions";
+ std::string tag = "PreprocessorDefinitions";
if (lang == "CUDA") {
tag = "Defines";
}
@@ -473,7 +483,7 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories(
return;
}
- const char* tag = "AdditionalIncludeDirectories";
+ std::string tag = "AdditionalIncludeDirectories";
if (lang == "CUDA") {
tag = "Include";
} else if (lang == "ASM_MASM" || lang == "ASM_NASM") {
@@ -528,6 +538,6 @@ void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout,
sep = ";";
}
- this->OutputFlag(fout, indent, m.first.c_str(), oss.str());
+ this->OutputFlag(fout, indent, m.first, oss.str());
}
}