diff --git a/source/dub/compilers/dmd.d b/source/dub/compilers/dmd.d index 5e1ba32..9018529 100644 --- a/source/dub/compilers/dmd.d +++ b/source/dub/compilers/dmd.d @@ -123,8 +123,7 @@ { import std.string; auto tpath = Path(settings.targetPath) ~ getTargetFileName(settings, platform); - string[] dflags = settings.targetType == TargetType.library || settings.targetType == TargetType.staticLibrary ? ["-lib"] : []; - auto args = ["dmd", "-of"~tpath.toNativeString()] ~ objects ~ dflags ~ settings.lflags.map!(l => "-L"~l)().array() ~ settings.sourceFiles; + auto args = ["dmd", "-of"~tpath.toNativeString()] ~ objects ~ settings.lflags.map!(l => "-L"~l)().array() ~ settings.sourceFiles; logDebug("%s", args.join(" ")); auto res = spawnProcess(args).wait(); enforce(res == 0, "Link command failed with exit code "~to!string(res)); diff --git a/source/dub/generators/build.d b/source/dub/generators/build.d index 452b498..328536c 100644 --- a/source/dub/generators/build.d +++ b/source/dub/generators/build.d @@ -54,6 +54,7 @@ } auto generate_binary = !buildsettings.dflags.canFind("-o-"); + auto is_static_library = buildsettings.targetType == TargetType.staticLibrary || buildsettings.targetType == TargetType.library; // make paths relative to shrink the command line foreach(ref f; buildsettings.sourceFiles){ @@ -115,7 +116,7 @@ on the other compilers. Later this should be integrated somehow in the build process (either in the package.json, or using a command line flag) */ - if( settings.compiler.name != "dmd" || !generate_binary ){ + if (settings.compiler.name != "dmd" || !generate_binary || is_static_library) { // setup for command line if( generate_binary ) settings.compiler.setTarget(buildsettings, settings.platform); settings.compiler.prepareBuildSettings(buildsettings, BuildSetting.commandLine);