diff --git a/source/dub/compilers/dmd.d b/source/dub/compilers/dmd.d index 2429f8c..c890ecd 100644 --- a/source/dub/compilers/dmd.d +++ b/source/dub/compilers/dmd.d @@ -293,7 +293,7 @@ string[] lflagsToDFlags(in string[] lflags) const { - return lflags.map!(f => "-L"~f)().array(); + return map!(f => "-L"~f)(lflags.filter!(f => f != "")()).array(); } private auto escapeArgs(in string[] args) diff --git a/source/dub/compilers/gdc.d b/source/dub/compilers/gdc.d index 30e07f5..4a9c0d2 100644 --- a/source/dub/compilers/gdc.d +++ b/source/dub/compilers/gdc.d @@ -233,6 +233,9 @@ string[] dflags; foreach( f; lflags ) { + if ( f == "") { + continue; + } dflags ~= "-Xlinker"; dflags ~= f; } diff --git a/source/dub/compilers/ldc.d b/source/dub/compilers/ldc.d index c263bea..11c2872 100644 --- a/source/dub/compilers/ldc.d +++ b/source/dub/compilers/ldc.d @@ -236,7 +236,7 @@ string[] lflagsToDFlags(in string[] lflags) const { - return lflags.map!(s => "-L="~s)().array(); + return map!(f => "-L"~f)(lflags.filter!(f => f != "")()).array(); } private auto escapeArgs(in string[] args) diff --git a/test/issue1003-check-empty-ld-flags.sh b/test/issue1003-check-empty-ld-flags.sh new file mode 100755 index 0000000..61678f7 --- /dev/null +++ b/test/issue1003-check-empty-ld-flags.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +. $(dirname "${BASH_SOURCE[0]}")/common.sh + +cd ${CURR_DIR}/issue1003-check-empty-ld-flags + +${DUB} build --compiler=${DC} --force diff --git a/test/issue1003-check-empty-ld-flags/dub.json b/test/issue1003-check-empty-ld-flags/dub.json new file mode 100644 index 0000000..7c4c251 --- /dev/null +++ b/test/issue1003-check-empty-ld-flags/dub.json @@ -0,0 +1,10 @@ +{ + "authors": [ + "--" + ], + "copyright": "Copyright © 2019, --", + "description": "--", + "license": "--", + "name": "issue1003-empty-ld-flags", + "lflags": [""] +} diff --git a/test/issue1003-check-empty-ld-flags/source/app.d b/test/issue1003-check-empty-ld-flags/source/app.d new file mode 100644 index 0000000..c3eec7f --- /dev/null +++ b/test/issue1003-check-empty-ld-flags/source/app.d @@ -0,0 +1,6 @@ +import std.stdio; + +void main() +{ + writeln("Edit source/app.d to start your project."); +}