瀏覽代碼

Fix link error when debug is enabled (#2224)

Caleb Kiage 2 年之前
父節點
當前提交
2ba6f0664a
共有 1 個文件被更改,包括 10 次插入2 次删除
  1. 10 2
      packages/c/catch2/xmake.lua

+ 10 - 2
packages/c/catch2/xmake.lua

@@ -39,14 +39,22 @@ package("catch2")
     end)
     end)
 
 
     on_component("main", function (package, component)
     on_component("main", function (package, component)
-        component:add("links", "Catch2Main")
+        local link = "Catch2Main"
+        if package:is_debug() then
+            link = link.."d"
+        end
+        component:add("links", link)
         if package:is_plat("windows") then
         if package:is_plat("windows") then
             component:add("ldflags", "-subsystem:console")
             component:add("ldflags", "-subsystem:console")
         end
         end
     end)
     end)
 
 
     on_component("lib", function (package, component)
     on_component("lib", function (package, component)
-        component:add("links", "Catch2")
+        local link = "Catch2"
+        if package:is_debug() then
+            link = link.."d"
+        end
+        component:add("links", link)
     end)
     end)
 
 
     on_install(function (package)
     on_install(function (package)