summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-12-17 10:13:53 +0100
committerGitHub <noreply@github.com>2016-12-17 10:13:53 +0100
commit4fcb6c02659997914d0a78a86e9ad2642edcc07a (patch)
tree6d9793621878f0992ade4d3180f00a7397faf66a
parentf8a9382819bc4d7ff369cf3065769e971c29cb2d (diff)
parentb99f3743e7371cc2975d5b9a7a6b0cbb7eb7f742 (diff)
downloadNim-4fcb6c02659997914d0a78a86e9ad2642edcc07a.tar.gz
Merge pull request #5124 from vegansk/fix_lib_out
Use ``out`` compiler option when linking static library
-rw-r--r--compiler/extccomp.nim10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim
index 735b44028..402c9592e 100644
--- a/compiler/extccomp.nim
+++ b/compiler/extccomp.nim
@@ -659,8 +659,14 @@ proc compileCFile(list: TLinkedList, script: var Rope, cmds: var TStringSeq,
 
 proc getLinkCmd(projectfile, objfiles: string): string =
   if optGenStaticLib in gGlobalOptions:
-    let name = splitFile(gProjectName).name
-    result = CC[cCompiler].buildLib % ["libfile", (libNameTmpl() % name),
+    var libname: string
+    if options.outFile.len > 0:
+      libname = options.outFile.expandTilde
+      if not libname.isAbsolute():
+        libname = getCurrentDir() / libname
+    else:
+      libname = (libNameTmpl() % splitFile(gProjectName).name)
+    result = CC[cCompiler].buildLib % ["libfile", libname,
                                        "objfiles", objfiles]
   else:
     var linkerExe = getConfigVar(cCompiler, ".linkerexe")