summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2017-02-13 11:08:18 +0800
committerJohn Hodge <tpg@ucc.asn.au>2017-02-13 11:08:18 +0800
commite97cbf893790226fb535deb6a2ef7d9d53234a2b (patch)
tree55e1ecc034004e7594d70ad3051bf6fa9ccd900c
parent82989b54c57fb4a4a319fe1bc863c371a36a0b28 (diff)
downloadmrust-e97cbf893790226fb535deb6a2ef7d9d53234a2b.tar.gz
main - Support `-l` argument
-rw-r--r--src/main.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index c69ddf49..3eb385f7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -132,6 +132,7 @@ struct ProgramParams
::std::string crate_name;
::std::vector<const char*> lib_search_dirs;
+ ::std::vector<const char*> libraries;
::std::set< ::std::string> features;
@@ -446,6 +447,9 @@ int main(int argc, char *argv[])
for(const char* libdir : params.lib_search_dirs ) {
trans_opt.library_search_dirs.push_back( libdir );
}
+ for(const char* libdir : params.libraries ) {
+ trans_opt.libraries.push_back( libdir );
+ }
// Generate code for non-generic public items (if requested)
switch( crate_type )
@@ -532,7 +536,9 @@ ProgramParams::ProgramParams(int argc, char *argv[])
{
arg ++; // eat '-'
- if( *arg == 'L' ) {
+ switch( *arg )
+ {
+ case 'L':
if( arg[1] == '\0' ) {
if( i == argc - 1 ) {
// TODO: BAIL!
@@ -544,6 +550,21 @@ ProgramParams::ProgramParams(int argc, char *argv[])
this->lib_search_dirs.push_back( arg+1 );
}
continue ;
+ case 'l':
+ if( arg[1] == '\0' ) {
+ if( i == argc - 1 ) {
+ // TODO: BAIL!
+ exit(1);
+ }
+ this->libraries.push_back( argv[++i] );
+ }
+ else {
+ this->libraries.push_back( arg+1 );
+ }
+ continue ;
+
+ default:
+ break;
}
for( ; *arg; arg ++ )