diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-08-27 21:43:42 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-08-27 21:43:42 +0200 |
commit | ba5fbfe36fd9934398e8030253c4d0b87c81fd03 (patch) | |
tree | 6e020cbde8acc900ed041127e8373e8af2e33e29 /libcppbuild.cc | |
parent | 9955c843e4795cdb6145e803caa6db7387796694 (diff) |
Make re-builds work even if binary name is not cppbuild. Block re-launch non-build args are given, such as -a or -d.
Diffstat (limited to 'libcppbuild.cc')
-rw-r--r-- | libcppbuild.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libcppbuild.cc b/libcppbuild.cc index 1174421..d3d8a51 100644 --- a/libcppbuild.cc +++ b/libcppbuild.cc @@ -44,6 +44,7 @@ int main(int argc, char* argv[]) std::vector<std::string> remove_files; bool list_files{false}; bool list_targets{false}; + bool no_relaunch{false}; // true means no re-launch after rebuild. dg::Options opt; int key{128}; @@ -81,6 +82,7 @@ int main(int argc, char* argv[]) opt.add("add", required_argument, 'a', "Add specified file to the build configurations.", [&]() { + no_relaunch = true; add_files.push_back(optarg); return 0; }); @@ -88,6 +90,7 @@ int main(int argc, char* argv[]) opt.add("remove", required_argument, 'r', "Remove specified file from the build configurations.", [&]() { + no_relaunch = true; remove_files.push_back(optarg); return 0; }); @@ -95,6 +98,7 @@ int main(int argc, char* argv[]) opt.add("list-files", no_argument, 'L', "List files in the build configurations.", [&]() { + no_relaunch = true; list_files = true; return 0; }); @@ -102,6 +106,7 @@ int main(int argc, char* argv[]) opt.add("list-targets", no_argument, 'l', "List targets.", [&]() { + no_relaunch = true; list_targets = true; return 0; }); @@ -109,6 +114,7 @@ int main(int argc, char* argv[]) opt.add("configure-cmd", no_argument, key++, "Print commandline for last configure.", [&]() { + no_relaunch = true; print_configure_cmd = true; return 0; }); @@ -116,6 +122,7 @@ int main(int argc, char* argv[]) opt.add("configure-db", no_argument, key++, "Print entire configure parameter database.", [&]() { + no_relaunch = true; print_configure_db = true; return 0; }); @@ -123,6 +130,7 @@ int main(int argc, char* argv[]) opt.add("database", required_argument, 'd', "Write compilation database json file.", [&]() { + no_relaunch = true; write_compilation_database = true; compilation_database = optarg; return 0; @@ -167,8 +175,6 @@ Options: { std::cout << file << "\n"; } - - return 0; } if(!add_files.empty() || !remove_files.empty()) @@ -184,7 +190,7 @@ Options: } // Force rebuild if files were added - recompileCheck(settings, 1, argv, true); + recompileCheck(settings, 1, argv, true, no_relaunch == false); } recompileCheck(settings, argc, argv); @@ -203,7 +209,6 @@ Options: std::cout << task->name() << "\n"; } } - return 0; } if(write_compilation_database) @@ -234,7 +239,6 @@ Options: if(print_configure_cmd) { std::cout << getConfiguration("cmd") << "\n"; - return 0; } if(print_configure_db) @@ -244,7 +248,6 @@ Options: { std::cout << config.first << ": " << config.second << "\n"; } - return 0; } for(auto task : all_tasks) @@ -256,7 +259,7 @@ Options: } bool build_all{true}; - for(auto const &arg : opt.arguments()) + for(const auto& arg : opt.arguments()) { if(arg == "configure") { |