Sort globbed files alphabetically for consistent cross-OS generation

toml-checker
Duncan Ogilvie 4 years ago
parent d62dff29b1
commit 598c9b9ba8

@ -21,8 +21,7 @@ const char *handle_args(int argc, char **argv) {
throw std::runtime_error(cmkr::help::message());
std::string main_arg = args[1];
if (main_arg == "gen") {
auto current_path = fs::current_path();
auto ret = cmkr::gen::generate_cmake(current_path.string().c_str());
auto ret = cmkr::gen::generate_cmake(fs::current_path().string().c_str());
if (ret)
return "CMake generation error!";
return "CMake generation successful!";

@ -23,7 +23,7 @@ int run(int argc, char **argv) {
std::stringstream ss;
if (!fs::exists("CMakeLists.txt"))
if (gen::generate_cmake("."))
if (gen::generate_cmake(fs::current_path().string().c_str()))
throw std::runtime_error("CMake generation failure!");
ss << "cmake -S. -B" << cmake.build_dir << " ";

@ -70,6 +70,8 @@ static std::vector<std::string> expand_cmake_path(const fs::path &name, const fs
for (auto &path : temp) {
std::replace(path.begin(), path.end(), '\\', '/');
}
// Sort paths alphabetically for consistent cross-OS generation
std::sort(temp.begin(), temp.end());
return temp;
}

Loading…
Cancel
Save