Browse Source

Fix link error when debug is enabled (#2224)

Caleb Kiage 2 years ago
parent
commit
2ba6f0664a
1 changed files with 10 additions and 2 deletions
  1. 10 2
      packages/c/catch2/xmake.lua

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

@@ -39,14 +39,22 @@ package("catch2")
     end)
 
     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
             component:add("ldflags", "-subsystem:console")
         end
     end)
 
     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)
 
     on_install(function (package)