From 35f436f9b066eb26529f3ad56e7db43b242f60e1 Mon Sep 17 00:00:00 2001 From: nasso <11479594+nasso@users.noreply.github.com> Date: Sat, 10 Jul 2021 03:26:08 +0200 Subject: [PATCH] Add `gtest_main` and configs to `gtest` (#478) Configuration options have been added to decide whether or not `gtest_main` should be linked against. For consistency, a similar option was added for the `gmock` target. --- packages/g/gtest/xmake.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/g/gtest/xmake.lua b/packages/g/gtest/xmake.lua index 43f5adbc0..65336b2de 100644 --- a/packages/g/gtest/xmake.lua +++ b/packages/g/gtest/xmake.lua @@ -10,6 +10,9 @@ package("gtest") add_versions("github:1.10.0", "release-1.10.0") add_versions("archive:1.10.0", "94c634d499558a76fa649edb13721dce6e98fb1e7018dfaeba3cd7a083945e91") + add_configs("main", {description = "Link to the gtest_main entry point.", default = false, type = "boolean"}) + add_configs("gmock", {description = "Link to the googlemock library.", default = true, type = "boolean"}) + if is_plat("linux") then add_syslinks("pthread") end @@ -23,9 +26,18 @@ package("gtest") add_includedirs("googletest/include", "googletest") add_headerfiles("googletest/include/(**.h)") + target("gtest_main") + set_kind("static") + set_languages("cxx11") + set_default(]] .. tostring(package:config("gtest_main")) .. [[) + add_files("googletest/src/gtest_main.cc") + add_includedirs("googletest/include", "googletest") + add_headerfiles("googletest/include/(**.h)") + target("gmock") set_kind("static") set_languages("cxx11") + set_default(]] .. tostring(package:config("gmock")) .. [[) add_files("googlemock/src/gmock-all.cc") add_includedirs("googlemock/include", "googlemock", "googletest/include", "googletest") add_headerfiles("googlemock/include/(**.h)")