add arg clean

self-hosting
MoAlyousef 4 years ago
parent 606d942ca0
commit a53aa34036

@ -43,7 +43,7 @@ const char *handle_args(int argc, char **argv) {
auto ret = build::clean(); auto ret = build::clean();
if (ret) if (ret)
return "CMake clean error!"; return "CMake clean error!";
return "CMake run completed!"; return "Cleaned build directory!";
} else { } else {
return "Unknown argument!"; return "Unknown argument!";
} }

@ -48,13 +48,13 @@ int run(int argc, char **argv) {
} }
int clean() { int clean() {
int ret = 0; bool ret = false;
cmake::CMake cmake(".", true); cmake::CMake cmake(".", true);
if (fs::exists(cmake.bin_dir)) { if (fs::exists(cmake.bin_dir)) {
ret = fs::remove_all(cmake.bin_dir); ret = fs::remove_all(cmake.bin_dir);
fs::create_directory(cmake.bin_dir); fs::create_directory(cmake.bin_dir);
} }
return ret; return !ret;
} }
} // namespace cmkr::build } // namespace cmkr::build

Loading…
Cancel
Save