Эх сурвалжийг харах

Merge pull request #3984 from laszlocsomor/wildcard

Windows: expand wildcard arguments
Feng Xiao 7 жил өмнө
parent
commit
e2c21e513c
1 өөрчлөгдсөн 13 нэмэгдсэн , 1 устгасан
  1. 13 1
      BUILD

+ 13 - 1
BUILD

@@ -1,4 +1,4 @@
-# Bazel (http://bazel.io/) BUILD file for Protobuf.
+# Bazel (https://bazel.build/) BUILD file for Protobuf.
 
 
 licenses(["notice"])
 licenses(["notice"])
 
 
@@ -55,6 +55,18 @@ config_setting(
 LINK_OPTS = select({
 LINK_OPTS = select({
     ":android": [],
     ":android": [],
     ":msvc": [],
     ":msvc": [],
+        # Linking to setargv.obj makes the default command line argument
+        # parser expand wildcards, so the main method's argv will contain the
+        # expanded list instead of the wildcards.
+        # Using -WHOLEARCHIVE, because:
+        # - Microsoft ships this object file next to default libraries
+        # - but this file is not a library, just a precompiled object
+        # - just listing the name here without "-WHOLEARCHIVE:" would make Bazel
+        #   believe that "setargv.obj" is a source or rule output in this
+        #   package, which it is not.
+        # See https://msdn.microsoft.com/en-us/library/8bch7bkk.aspx
+        "-WHOLEARCHIVE:setargv.obj",
+    ],
     "//conditions:default": ["-lpthread", "-lm"],
     "//conditions:default": ["-lpthread", "-lm"],
 })
 })