Skip to content

Commit 6799414

Browse files
src/dnmtools.cpp: adding preprocessor control to include full license information so it will be available in released binaries
1 parent 027cecd commit 6799414

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/dnmtools.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
#include <string>
2525
#include <vector>
2626

27+
#ifdef INCLUDE_FULL_LICENSE_INFO
28+
#include <license.h>
29+
#endif
30+
2731
using std::cout;
2832
using std::end;
2933
using std::endl;
@@ -34,10 +38,6 @@ using std::vector;
3438

3539
static const string PROGRAM_NAME = "dnmtools";
3640

37-
static const std::string license_text = R"(
38-
39-
)";
40-
4141
struct dnmtools_command {
4242
string tag;
4343
string description;
@@ -148,6 +148,9 @@ print_help(
148148
const vector<pair<string, vector<dnmtools_command>>> &command_groups) {
149149
cout << "Program: " << PROGRAM_NAME << "\n"
150150
<< "Version: " << VERSION << "\n"
151+
#ifdef INCLUDE_FULL_LICENSE_INFO
152+
<< "License: use --license for full license info\n"
153+
#endif
151154
<< "Usage: " << PROGRAM_NAME << " <command> [options]\n"
152155
<< "Commands:" << endl;
153156
for (auto &&g : command_groups) {
@@ -224,12 +227,14 @@ main(int argc, char *argv[]) {
224227
return EXIT_SUCCESS;
225228
}
226229

230+
#ifdef INCLUDE_FULL_LICENSE_INFO
227231
for (auto i = 0; i < argc; ++i) {
228232
if (std::string(argv[i]) == "--license") {
229233
std::cout << license_text;
230234
return EXIT_SUCCESS;
231235
}
232236
}
237+
#endif
233238

234239
const auto has_tag = [&](const dnmtools_command &a) {
235240
return a.tag == argv[1];

0 commit comments

Comments
 (0)