summaryrefslogtreecommitdiff
path: root/libcppbuild.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libcppbuild.cc')
-rw-r--r--libcppbuild.cc17
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")
{