ruki před 11 měsíci
rodič
revize
9fefb97834
1 změnil soubory, kde provedl 9 přidání a 7 odebrání
  1. 9 7
      packages/c/catch2/xmake.lua

+ 9 - 7
packages/c/catch2/xmake.lua

@@ -58,13 +58,6 @@ package("catch2")
             link = link.."d"
         end
         component:add("links", link)
-        if package:is_plat("windows") then
-            if package:has_tool("cxx", "cl") then
-                component:add("ldflags", "-subsystem:console")
-            elseif package:has_tool("cxx", "clang", "clangxx") then
-                component:add("ldflags", "-Wl,/subsystem:console")
-            end
-        end
     end)
 
     on_component("lib", function (package, component)
@@ -76,6 +69,15 @@ package("catch2")
     end)
 
     on_install(function (package)
+        if package:is_plat("windows") then
+            local main_component = package:component("main")
+            if package:has_tool("cxx", "cl") then
+                main_component:add("ldflags", "-subsystem:console")
+            elseif package:has_tool("cxx", "clang", "clangxx") then
+                main_component:add("ldflags", "-Wl,/subsystem:console")
+            end
+        end
+
         if package:version():ge("3.0") then
             local configs = {"-DCATCH_INSTALL_DOCS=OFF", "-DCATCH_BUILD_TESTING=OFF", "-DCATCH_BUILD_EXAMPLES=OFF"}
             table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))