VS: Do not use absolute paths to CUDA sources

The CUDA Toolkit's VS integration does not properly compute the
intermediate files directory location when the path to the source
file is absolute.
This commit is contained in:
Brad King 2017-03-07 16:07:12 -05:00
parent b64b4629ea
commit b966f489c1

View File

@ -1717,8 +1717,10 @@ void cmVisualStudio10TargetGenerator::WriteSource(std::string const& tool,
//
// and fail if this exceeds the maximum allowed path length. Our path
// conversion uses full paths when possible to allow deeper trees.
bool forceRelative = false;
std::string sourceFile = this->ConvertPath(sf->GetFullPath(), false);
// However, CUDA 8.0 msbuild rules fail on absolute paths so for CUDA
// we must use relative paths.
bool forceRelative = sf->GetLanguage() == "CUDA";
std::string sourceFile = this->ConvertPath(sf->GetFullPath(), forceRelative);
if (this->LocalGenerator->GetVersion() ==
cmGlobalVisualStudioGenerator::VS10 &&
cmSystemTools::FileIsFullPath(sourceFile.c_str())) {