Skip to content

Commit dd10896

Browse files
committed
refactor: cmake help can use OS defaults
1 parent c438bd9 commit dd10896

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

src/lib/Lib/CMakeExecution.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,19 @@ executeCmakeHelp(llvm::StringRef cmakePath)
7474
Expected<std::string>
7575
getCmakeDefaultGenerator(llvm::StringRef cmakePath)
7676
{
77-
MRDOCS_TRY(auto const cmakeHelp, executeCmakeHelp(cmakePath));
77+
Expected<std::string> const cmakeHelpExp = executeCmakeHelp(cmakePath);
78+
if (!cmakeHelpExp) {
79+
if (llvm::sys::path::extension(cmakePath) == ".exe")
80+
{
81+
return "Visual Studio 17 2022";
82+
}
83+
else
84+
{
85+
return "Unix Makefiles";
86+
}
87+
}
7888

89+
std::string const cmakeHelp = *std::move(cmakeHelpExp);
7990
std::istringstream stream(cmakeHelp);
8091
std::string line;
8192
std::string defaultGenerator;

src/tool/GenerateAction.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,6 @@ DoGenerateAction()
179179
compileCommands, config,
180180
defaultIncludePaths);
181181

182-
// Normalize outputPath path
183-
MRDOCS_CHECK(toolArgs.outputPath, "The output path argument is missing");
184-
toolArgs.outputPath = files::normalizePath(
185-
files::makeAbsolute(toolArgs.outputPath,
186-
(*config)->workingDir));
187-
188182
// --------------------------------------------------------------
189183
//
190184
// Build corpus
@@ -206,6 +200,12 @@ DoGenerateAction()
206200
// Generate docs
207201
//
208202
// --------------------------------------------------------------
203+
// Normalize outputPath path
204+
MRDOCS_CHECK(toolArgs.outputPath, "The output path argument is missing");
205+
toolArgs.outputPath = files::normalizePath(
206+
files::makeAbsolute(
207+
toolArgs.outputPath,
208+
(*config)->workingDir));
209209
report::info("Generating docs\n");
210210
MRDOCS_TRY(generator.build(toolArgs.outputPath.getValue(), *corpus));
211211
return {};

0 commit comments

Comments
 (0)