Skip to content

Commit b5a36db

Browse files
committed
refactor: compilation database ensures std
fix #694
1 parent 9871794 commit b5a36db

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/lib/Lib/MrDocsCompilationDatabase.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,18 @@ adjustCommandLine(
359359
new_cmdline.emplace_back(target);
360360
}();
361361
}
362-
362+
363+
// ------------------------------------------------------
364+
// Language standard
365+
// ------------------------------------------------------
366+
constexpr auto is_std_option = [](std::string_view opt) {
367+
return opt.starts_with("-std=") || opt.starts_with("--std=") || opt.starts_with("/std:");
368+
};
369+
if (std::ranges::find_if(cmdline, is_std_option) == cmdline.end())
370+
{
371+
new_cmdline.emplace_back("-std=c++23");
372+
}
373+
363374
// ------------------------------------------------------
364375
// Add additional defines
365376
// ------------------------------------------------------

0 commit comments

Comments
 (0)