From 9691d528c9e7845c2f8c408c3af8b9f72e03452e Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 5 Sep 2024 10:58:15 -0400 Subject: [PATCH] Fix catch2 v2.x install failures (#5145) --- packages/c/catch2/xmake.lua | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/c/catch2/xmake.lua b/packages/c/catch2/xmake.lua index 3e4e00379..9c1bdb0f0 100644 --- a/packages/c/catch2/xmake.lua +++ b/packages/c/catch2/xmake.lua @@ -67,19 +67,26 @@ package("catch2") link = link.."d" end component:add("links", link) - end) - - on_install(function (package) - if package:is_plat("windows") then - local main_component = package:component("main") + if package:is_plat("windows") and package:version():le("3.0") then if package:has_tool("cxx", "cl") then - main_component:add("ldflags", "-subsystem:console") + component:add("ldflags", "-subsystem:console") elseif package:has_tool("cxx", "clang", "clangxx") then - main_component:add("ldflags", "-Wl,/subsystem:console") + component:add("ldflags", "-Wl,/subsystem:console") end end + end) + on_install(function (package) if package:version():ge("3.0") then + 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 + 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")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))