diff options
Diffstat (limited to 'Source')
30 files changed, 164 insertions, 117 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ea6e0e2..fcb0b8b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 8) -set(CMake_VERSION_PATCH 20170421) +set(CMake_VERSION_PATCH 20170424) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 3aebbc8..57b47f1 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -288,7 +288,7 @@ public: hasFiles = false; hasErrors = false; - basePath = cmSystemTools::GetFilenamePath(installer->Resources[r].data()); + basePath = cmSystemTools::GetFilenamePath(installer->Resources[r]); ParseFile(installer->Resources[r].data()); @@ -360,8 +360,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() cmSystemTools::GetFilenameName(InstallerApplicationIcon); std::string path = Directory + "/config/" + name; name = cmSystemTools::GetFilenameWithoutExtension(name); - cmsys::SystemTools::CopyFileIfDifferent(InstallerApplicationIcon.data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(InstallerApplicationIcon, path); xout.Element("InstallerApplicationIcon", name); } @@ -369,8 +368,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!InstallerWindowIcon.empty()) { std::string name = cmSystemTools::GetFilenameName(InstallerWindowIcon); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(InstallerWindowIcon.data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(InstallerWindowIcon, path); xout.Element("InstallerWindowIcon", name); } @@ -378,7 +376,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!Logo.empty()) { std::string name = cmSystemTools::GetFilenameName(Logo); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Logo.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Logo, path); xout.Element("Logo", name); } @@ -386,7 +384,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!Banner.empty()) { std::string name = cmSystemTools::GetFilenameName(Banner); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Banner.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Banner, path); xout.Element("Banner", name); } @@ -394,7 +392,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!Watermark.empty()) { std::string name = cmSystemTools::GetFilenameName(Watermark); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Watermark.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Watermark, path); xout.Element("Watermark", name); } @@ -402,7 +400,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!Background.empty()) { std::string name = cmSystemTools::GetFilenameName(Background); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Background.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Background, path); xout.Element("Background", name); } @@ -480,7 +478,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!IsVersionLess("2.0") && !ControlScript.empty()) { std::string name = cmSystemTools::GetFilenameName(ControlScript); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(ControlScript.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(ControlScript, path); xout.Element("ControlScript", name); } @@ -492,8 +490,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (parser.ParseResource(i)) { std::string name = cmSystemTools::GetFilenameName(Resources[i]); std::string path = Directory + "/resources/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Resources[i].data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Resources[i], path); resources.push_back(name); } else { cmCPackLogger(cmCPackLog::LOG_WARNING, "Can't copy resources from \"" diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 2a95ba8..99e8b9e 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -590,7 +590,7 @@ void cmCPackIFWPackage::GeneratePackageFile() if (!Script.empty()) { std::string name = cmSystemTools::GetFilenameName(Script); std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Script.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Script, path); xout.Element("Script", name); } @@ -599,8 +599,7 @@ void cmCPackIFWPackage::GeneratePackageFile() for (size_t i = 0; i < userInterfaces.size(); i++) { std::string name = cmSystemTools::GetFilenameName(userInterfaces[i]); std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i].data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i], path); userInterfaces[i] = name; } if (!userInterfaces.empty()) { @@ -616,8 +615,7 @@ void cmCPackIFWPackage::GeneratePackageFile() for (size_t i = 0; i < translations.size(); i++) { std::string name = cmSystemTools::GetFilenameName(translations[i]); std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(translations[i].data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(translations[i], path); translations[i] = name; } if (!translations.empty()) { @@ -675,7 +673,7 @@ void cmCPackIFWPackage::GeneratePackageFile() for (size_t i = 1; i < licenses.size(); i += 2) { std::string name = cmSystemTools::GetFilenameName(licenses[i]); std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(licenses[i].data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(licenses[i], path); licenses[i] = name; } if (!licenses.empty()) { diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 4d970d5..87c532c 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -2222,7 +2222,8 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir) if (line.empty() || line[0] == '#') { // Ignore blank and comment lines. continue; - } else if (line[0] == ' ') { + } + if (line[0] == ' ') { // Label lines appear indented by one space. std::string label = line.substr(1); int id = this->GetLabelId(label); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 7195bb3..a782150 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -306,7 +306,8 @@ void cmCTestLaunch::LoadLabels() if (line.empty() || line[0] == '#') { // Ignore blank and comment lines. continue; - } else if (line[0] == ' ') { + } + if (line[0] == ' ') { // Label lines appear indented by one space. if (inTarget || inSource) { this->Labels.insert(line.c_str() + 1); diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index d738a1b..fdc16b1 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -561,7 +561,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() // In parallel test runs repeatedly move dependencies of the tests on // the current dependency level to the next level until no // further dependencies exist. - while (priorityStack.back().size()) { + while (!priorityStack.back().empty()) { TestSet& previousSet = priorityStack.back(); priorityStack.push_back(TestSet()); TestSet& currentSet = priorityStack.back(); diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index 9ae48d8..9cdd50b 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -46,7 +46,8 @@ public: beginSet.push_back("begin"); coverageVector.push_back(-1); continue; - } else if (line.find('{') != line.npos) { + } + if (line.find('{') != line.npos) { blockComFlag = true; } else if (line.find('}') != line.npos) { blockComFlag = false; diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index d299547..7fb065d 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -159,7 +159,8 @@ void cmCursesLongMessageForm::HandleInput() // quit if (key == 'o' || key == 'e') { break; - } else if (key == KEY_DOWN || key == ctrl('n')) { + } + if (key == KEY_DOWN || key == ctrl('n')) { form_driver(this->Form, REQ_SCR_FLINE); } else if (key == KEY_UP || key == ctrl('p')) { form_driver(this->Form, REQ_SCR_BLINE); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 939c736..ca824c0 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -764,9 +764,8 @@ void cmCursesMainForm::HandleInput() // quit if (key == 'q') { break; - } else { - continue; } + continue; } currentField = current_field(this->Form); @@ -826,7 +825,7 @@ void cmCursesMainForm::HandleInput() // (index always corresponds to the value field) // scroll down with arrow down, ctrl+n (emacs binding), or j (vim // binding) - else if (key == KEY_DOWN || key == ctrl('n') || key == 'j') { + if (key == KEY_DOWN || key == ctrl('n') || key == 'j') { FIELD* cur = current_field(this->Form); size_t findex = field_index(cur); if (findex == 3 * this->NumberOfVisibleEntries - 1) { diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 34ec0e3..dbd4dd1 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -32,7 +32,8 @@ bool cmAddSubDirectoryCommand::InitialPass( if (*i == "EXCLUDE_FROM_ALL") { excludeFromAll = true; continue; - } else if (binArg.empty()) { + } + if (binArg.empty()) { binArg = *i; } else { this->SetError("called with incorrect number of arguments"); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 034a266..fa166a0 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -613,8 +613,8 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) continue; } - else if ((c >= 0x20 && c < 0x7F) || c == '\t' || - (c == '\n' && newline_consume)) { + if ((c >= 0x20 && c < 0x7F) || c == '\t' || + (c == '\n' && newline_consume)) { // This is an ASCII character that may be part of a string. // Cast added to avoid compiler warning. Cast is ok because // c is guaranteed to fit in char by the above if... diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx index 9e66035..ed794c3 100644 --- a/Source/cmFileMonitor.cxx +++ b/Source/cmFileMonitor.cxx @@ -236,7 +236,7 @@ public: cmFileMonitor::Callback cb) : Parent(p) , PathSegment(ps) - , CbList({ cb }) + , CbList({ std::move(cb) }) { assert(p); assert(!ps.empty()); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 1d6e7fe..a0f677b 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -536,6 +536,18 @@ const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file) return this->Objects[file]; } +const char* cmGeneratorTarget::GetCustomObjectExtension() const +{ + static std::string extension; + const bool has_ptx_extension = + this->GetPropertyAsBool("CUDA_PTX_COMPILATION"); + if (has_ptx_extension) { + extension = ".ptx"; + return extension.c_str(); + } + return CM_NULLPTR; +} + void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile const* sf) { this->ExplicitObjectName.insert(sf); @@ -3961,15 +3973,14 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, << theTarget->GetName() << "\".\n"; cmSystemTools::Error(e.str().c_str()); break; - } else { - propContent = consistent.second; - continue; } - } else { - // Explicitly set on target and not set in iface. Can't disagree. + propContent = consistent.second; continue; } - } else if (impliedByUse) { + // Explicitly set on target and not set in iface. Can't disagree. + continue; + } + if (impliedByUse) { propContent = impliedValue<PropertyType>(propContent); if (ifaceIsSet) { @@ -3987,43 +3998,36 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, << "\" is in conflict.\n"; cmSystemTools::Error(e.str().c_str()); break; - } else { - propContent = consistent.second; - continue; } - } else { - // Implicitly set on target and not set in iface. Can't disagree. + propContent = consistent.second; continue; } - } else { - if (ifaceIsSet) { - if (propInitialized) { - std::pair<bool, PropertyType> consistent = - consistentProperty(propContent, ifacePropContent, t); - report += reportEntry; - report += compatibilityAgree(t, propContent != consistent.second); - if (!consistent.first) { - std::ostringstream e; - e << "The INTERFACE_" << p << " property of \"" - << theTarget->GetName() << "\" does\nnot agree with the value " - "of " - << p << " already determined\nfor \"" << tgt->GetName() - << "\".\n"; - cmSystemTools::Error(e.str().c_str()); - break; - } else { - propContent = consistent.second; - continue; - } - } else { - report += reportEntry + "(Interface set)\n"; - propContent = ifacePropContent; - propInitialized = true; + // Implicitly set on target and not set in iface. Can't disagree. + continue; + } + if (ifaceIsSet) { + if (propInitialized) { + std::pair<bool, PropertyType> consistent = + consistentProperty(propContent, ifacePropContent, t); + report += reportEntry; + report += compatibilityAgree(t, propContent != consistent.second); + if (!consistent.first) { + std::ostringstream e; + e << "The INTERFACE_" << p << " property of \"" + << theTarget->GetName() << "\" does\nnot agree with the value of " + << p << " already determined\nfor \"" << tgt->GetName() << "\".\n"; + cmSystemTools::Error(e.str().c_str()); + break; } - } else { - // Not set. Nothing to agree on. + propContent = consistent.second; continue; } + report += reportEntry + "(Interface set)\n"; + propContent = ifacePropContent; + propInitialized = true; + } else { + // Not set. Nothing to agree on. + continue; } } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 3a0d23f..8a687e8 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -124,6 +124,7 @@ public: void GetObjectSources(std::vector<cmSourceFile const*>&, const std::string& config) const; const std::string& GetObjectName(cmSourceFile const* file); + const char* GetCustomObjectExtension() const; bool HasExplicitObjectName(cmSourceFile const* file) const; void AddExplicitObjectName(cmSourceFile const* sf); diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 16297f3..929b1cd 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -16,7 +16,7 @@ struct cmListFileParser { - cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt, + cmListFileParser(cmListFile* lf, cmListFileBacktrace const& lfbt, cmMessenger* messenger, const char* filename); ~cmListFileParser(); void IssueFileOpenError(std::string const& text) const; @@ -39,7 +39,8 @@ struct cmListFileParser } Separation; }; -cmListFileParser::cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt, +cmListFileParser::cmListFileParser(cmListFile* lf, + cmListFileBacktrace const& lfbt, cmMessenger* messenger, const char* filename) : ListFile(lf) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 93db192..424ab6f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2162,7 +2162,7 @@ bool cmLocalGenerator::IsNMake() const std::string cmLocalGenerator::GetObjectFileNameWithoutTarget( const cmSourceFile& source, std::string const& dir_max, - bool* hasSourceExtension) + bool* hasSourceExtension, char const* customOutputExtension) { // Construct the object file name using the full path to the source // file which is its only unique identification. @@ -2223,7 +2223,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget( } // Remove the source extension if it is to be replaced. - if (replaceExt) { + if (replaceExt || customOutputExtension) { keptSourceExtension = false; std::string::size_type dot_pos = objectName.rfind('.'); if (dot_pos != std::string::npos) { @@ -2232,7 +2232,11 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget( } // Store the new extension. - objectName += this->GlobalGenerator->GetLanguageOutputExtension(source); + if (customOutputExtension) { + objectName += customOutputExtension; + } else { + objectName += this->GlobalGenerator->GetLanguageOutputExtension(source); + } } if (hasSourceExtension) { *hasSourceExtension = keptSourceExtension; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 3047257..1459a05 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -273,7 +273,8 @@ public: // Compute object file names. std::string GetObjectFileNameWithoutTarget( const cmSourceFile& source, std::string const& dir_max, - bool* hasSourceExtension = CM_NULLPTR); + bool* hasSourceExtension = CM_NULLPTR, + char const* customOutputExtension = CM_NULLPTR); /** Fill out the static linker flags for the given target. */ void GetStaticLibraryFlags(std::string& flags, std::string const& config, diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 9d88e35..e0e3e54 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -249,12 +249,15 @@ void cmLocalNinjaGenerator::ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, cmGeneratorTarget const* gt) { + // Determine if these object files should use a custom extension + char const* custom_ext = gt->GetCustomObjectExtension(); for (std::map<cmSourceFile const*, std::string>::iterator si = mapping.begin(); si != mapping.end(); ++si) { cmSourceFile const* sf = si->first; - si->second = - this->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory); + bool keptSourceExtension; + si->second = this->GetObjectFileNameWithoutTarget( + *sf, gt->ObjectDirectory, &keptSourceExtension, custom_ext); } } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 3313127..5f52786 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -159,12 +159,15 @@ void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, cmGeneratorTarget const* gt) { + // Determine if these object files should use a custom extension + char const* custom_ext = gt->GetCustomObjectExtension(); for (std::map<cmSourceFile const*, std::string>::iterator si = mapping.begin(); si != mapping.end(); ++si) { cmSourceFile const* sf = si->first; - si->second = - this->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory); + bool keptSourceExtension; + si->second = this->GetObjectFileNameWithoutTarget( + *sf, gt->ObjectDirectory, &keptSourceExtension, custom_ext); } } diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 3d7b60b..41025af 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -32,6 +32,7 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, cmGeneratorTarget const* gt) { + char const* custom_ext = gt->GetCustomObjectExtension(); std::string dir_max = this->ComputeLongestObjectDirectory(gt); // Count the number of object files with each name. Note that @@ -44,7 +45,12 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames( cmSourceFile const* sf = si->first; std::string objectNameLower = cmSystemTools::LowerCase( cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); - objectNameLower += this->GlobalGenerator->GetLanguageOutputExtension(*sf); + if (custom_ext) { + objectNameLower += custom_ext; + } else { + objectNameLower += + this->GlobalGenerator->GetLanguageOutputExtension(*sf); + } counts[objectNameLower] += 1; } @@ -57,10 +63,16 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames( cmSourceFile const* sf = si->first; std::string objectName = cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); - objectName += this->GlobalGenerator->GetLanguageOutputExtension(*sf); + if (custom_ext) { + objectName += custom_ext; + } else { + objectName += this->GlobalGenerator->GetLanguageOutputExtension(*sf); + } if (counts[cmSystemTools::LowerCase(objectName)] > 1) { const_cast<cmGeneratorTarget*>(gt)->AddExplicitObjectName(sf); - objectName = this->GetObjectFileNameWithoutTarget(*sf, dir_max); + bool keptSourceExtension; + objectName = this->GetObjectFileNameWithoutTarget( + *sf, dir_max, &keptSourceExtension, custom_ext); } si->second = objectName; } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 7acfb85..9c0520e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -589,6 +589,9 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( if (this->GeneratorTarget->GetPropertyAsBool( "CUDA_SEPARABLE_COMPILATION")) { cmdVar = std::string("CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION"); + } else if (this->GeneratorTarget->GetPropertyAsBool( + "CUDA_PTX_COMPILATION")) { + cmdVar = std::string("CMAKE_CUDA_COMPILE_PTX_COMPILATION"); } else { cmdVar = std::string("CMAKE_CUDA_COMPILE_WHOLE_COMPILATION"); } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 2c14a3e..e0b2217 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -589,6 +589,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) if (this->GeneratorTarget->GetPropertyAsBool( "CUDA_SEPARABLE_COMPILATION")) { cmdVar = std::string("CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION"); + } else if (this->GeneratorTarget->GetPropertyAsBool( + "CUDA_PTX_COMPILATION")) { + cmdVar = std::string("CMAKE_CUDA_COMPILE_PTX_COMPILATION"); } else { cmdVar = std::string("CMAKE_CUDA_COMPILE_WHOLE_COMPILATION"); } diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index 8b8cf07..2339d68 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -188,9 +188,8 @@ protected: if (qstart == std::string::npos) { cmSystemTools::Error("unknown include directive ", line.c_str()); continue; - } else { - qend = line.find('>', qstart + 1); } + qend = line.find('>', qstart + 1); } else { qend = line.find('\"', qstart + 1); } diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 70ffc7d..938cad9 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -96,14 +96,14 @@ void cmRST::ProcessModule(std::istream& is) if (line == "#") { this->ProcessLine(""); continue; - } else if (line.substr(0, 2) == "# ") { + } + if (line.substr(0, 2) == "# ") { this->ProcessLine(line.substr(2, line.npos)); continue; - } else { - rst = ""; - this->Reset(); - this->OutputLinePending = true; } + rst = ""; + this->Reset(); + this->OutputLinePending = true; } if (line == "#.rst:") { rst = "#"; diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index da26972..6425913 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -32,9 +32,8 @@ bool cmSetTargetPropertiesCommand::InitialPass( } propertyPairs.insert(propertyPairs.end(), j, args.end()); break; - } else { - numFiles++; } + numFiles++; } if (propertyPairs.empty()) { this->SetError("called with illegal arguments, maybe missing " diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index 4fd379f..e27c675 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -32,9 +32,8 @@ bool cmSetTestsPropertiesCommand::InitialPass( } propertyPairs.insert(propertyPairs.end(), j, args.end()); break; - } else { - numFiles++; } + numFiles++; } if (propertyPairs.empty()) { this->SetError("called with illegal arguments, maybe " diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 39625ae..6d620d9 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1707,7 +1707,8 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line, for (; outiter != out.end(); ++outiter) { if ((*outiter == '\r') && ((outiter + 1) == out.end())) { break; - } else if (*outiter == '\n' || *outiter == '\0') { + } + if (*outiter == '\n' || *outiter == '\0') { std::vector<char>::size_type length = outiter - out.begin(); if (length > 1 && *(outiter - 1) == '\r') { --length; @@ -1724,7 +1725,8 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line, for (; erriter != err.end(); ++erriter) { if ((*erriter == '\r') && ((erriter + 1) == err.end())) { break; - } else if (*erriter == '\n' || *erriter == '\0') { + } + if (*erriter == '\n' || *erriter == '\0') { std::vector<char>::size_type length = erriter - err.begin(); if (length > 1 && *(erriter - 1) == '\r') { --length; @@ -2623,29 +2625,28 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg, it = dentries.erase(it); entriesErased++; continue; - } else { - if (cmELF::TagMipsRldMapRel != 0 && - it->first == cmELF::TagMipsRldMapRel) { - // Background: debuggers need to know the "linker map" which contains - // the addresses each dynamic object is loaded at. Most arches use - // the DT_DEBUG tag which the dynamic linker writes to (directly) and - // contain the location of the linker map, however on MIPS the - // .dynamic section is always read-only so this is not possible. MIPS - // objects instead contain a DT_MIPS_RLD_MAP tag which contains the - // address where the dyanmic linker will write to (an indirect - // version of DT_DEBUG). Since this doesn't work when using PIE, a - // relative equivalent was created - DT_MIPS_RLD_MAP_REL. Since this - // version contains a relative offset, moving it changes the - // calculated address. This may cause the dyanmic linker to write - // into memory it should not be changing. - // - // To fix this, we adjust the value of DT_MIPS_RLD_MAP_REL here. If - // we move it up by n bytes, we add n bytes to the value of this tag. - it->second += entriesErased * sizeof_dentry; - } - - it++; } + if (cmELF::TagMipsRldMapRel != 0 && + it->first == cmELF::TagMipsRldMapRel) { + // Background: debuggers need to know the "linker map" which contains + // the addresses each dynamic object is loaded at. Most arches use + // the DT_DEBUG tag which the dynamic linker writes to (directly) and + // contain the location of the linker map, however on MIPS the + // .dynamic section is always read-only so this is not possible. MIPS + // objects instead contain a DT_MIPS_RLD_MAP tag which contains the + // address where the dyanmic linker will write to (an indirect + // version of DT_DEBUG). Since this doesn't work when using PIE, a + // relative equivalent was created - DT_MIPS_RLD_MAP_REL. Since this + // version contains a relative offset, moving it changes the + // calculated address. This may cause the dyanmic linker to write + // into memory it should not be changing. + // + // To fix this, we adjust the value of DT_MIPS_RLD_MAP_REL here. If + // we move it up by n bytes, we add n bytes to the value of this tag. + it->second += entriesErased * sizeof_dentry; + } + + it++; } // Encode new entries list diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index bda1d95..f675833 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -941,6 +941,14 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) } else if (cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME") && !this->CheckImportedLibName(prop, value ? value : "")) { /* error was reported by check method */ + } else if (prop == "CUDA_PTX_COMPILATION" && + this->GetType() != cmStateEnums::OBJECT_LIBRARY) { + std::ostringstream e; + e << "CUDA_PTX_COMPILATION property can only be applied to OBJECT " + "targets (\"" + << this->Name << "\")\n"; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + return; } else { this->Properties.SetProperty(prop, value); } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index adf5f74..d83662e 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2467,6 +2467,12 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( if (this->GeneratorTarget->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION")) { cudaOptions.AddFlag("GenerateRelocatableDeviceCode", "true"); + } else if (this->GeneratorTarget->GetPropertyAsBool( + "CUDA_PTX_COMPILATION")) { + cudaOptions.AddFlag("NvccCompilation", "ptx"); + // We drop the %(Extension) component as CMake expects all PTX files + // to not have the source file extension at all + cudaOptions.AddFlag("CompileOut", "$(IntDir)%(Filename).ptx"); } // Convert the host compiler options to the toolset's abstractions diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 974dd5f..cc954e6 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1450,7 +1450,8 @@ bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg, if (*arg == "--") { ++arg; break; - } else if (*arg == "--manifests") { + } + if (*arg == "--manifests") { for (++arg; arg != argEnd && !cmHasLiteralPrefix(*arg, "-"); ++arg) { this->UserManifests.push_back(*arg); } |