diff --git a/src/cmkrlib/args.cpp b/src/cmkrlib/args.cpp index 1a5d94a..05cf3db 100644 --- a/src/cmkrlib/args.cpp +++ b/src/cmkrlib/args.cpp @@ -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!"; diff --git a/src/cmkrlib/build.cpp b/src/cmkrlib/build.cpp index 4609238..83b2666 100644 --- a/src/cmkrlib/build.cpp +++ b/src/cmkrlib/build.cpp @@ -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 << " "; diff --git a/src/cmkrlib/gen.cpp b/src/cmkrlib/gen.cpp index d2286bb..7e39731 100644 --- a/src/cmkrlib/gen.cpp +++ b/src/cmkrlib/gen.cpp @@ -70,6 +70,8 @@ static std::vector 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; }