aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-03-27 20:28:05 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-03-28 11:39:55 +0300
commit2d9112e84d735e1948313240df8d5140364cca0e (patch)
treefed3093ccff289a0f3c7a507637c850a168c15a3
parent7ea85767a2b0dd7d16f60f83a194ff05a2e2f619 (diff)
Add export-stub sub-option to bdep-new --type exe option
-rw-r--r--bdep/new.cli5
-rw-r--r--bdep/new.cxx18
2 files changed, 23 insertions, 0 deletions
diff --git a/bdep/new.cli b/bdep/new.cli
index 7bbfe8f..bcbc6c6 100644
--- a/bdep/new.cli
+++ b/bdep/new.cli
@@ -316,6 +316,10 @@ namespace bdep
Don't add support for installing.|
+ \li|\n\ \ \ \cb{export-stub}
+
+ Add support for importing this project's targets from other projects.|
+
\li|\n\ \ \ \c{\b{prefix=}\i{dir}}
Optional source prefix relative to project/package root.|
@@ -642,6 +646,7 @@ namespace bdep
bool no-tests;
bool unit-tests;
bool no-install;
+ bool export-stub;
dir_path prefix;
dir_path subdir;
bool no-subdir;
diff --git a/bdep/new.cxx b/bdep/new.cxx
index 229a21d..e461d42 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -2777,6 +2777,24 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
}
}
+ // build/export.build
+ //
+ if (!src && t.exe_opt.export_stub ())
+ {
+ string sd (
+ (pfx_src / (sub_src && !bfile_in_pfx_src ? sub : empty_dir_path)).
+ posix_representation ());
+
+ open (bd / "export." + build_ext);
+ os << "$out_root/" << '\n'
+ << "{" << '\n'
+ << " include " << (!sd.empty () ? sd : "./") << '\n'
+ << "}" << '\n'
+ << '\n'
+ << "export $out_root/" << sd << "$import.target" << '\n';
+ os.close ();
+ }
+
break;
}
case type::lib: