cmake: Avoid calling GetCMakeListFile with empty directory

This commit is contained in:
Brad King
2025-11-04 19:12:41 -05:00
parent f6b3ba5f55
commit 40b093649b

View File

@@ -4517,8 +4517,8 @@ void cmake::SetCMakeListName(std::string const& name)
std::string cmake::GetCMakeListFile(std::string const& dir) const
{
cm::string_view const slash =
dir.empty() || dir.back() != '/' ? "/"_s : ""_s;
assert(!dir.empty());
cm::string_view const slash = dir.back() != '/' ? "/"_s : ""_s;
std::string listFile;
if (!this->CMakeListName.empty()) {
listFile = cmStrCat(dir, slash, this->CMakeListName);