|
@@ -9,13 +9,21 @@ package("gtest")
|
|
|
add_versions("archive:1.8.1", "927827c183d01734cc5cfef85e0ff3f5a92ffe6188e0d18e909c5efebf28a0c7")
|
|
|
|
|
|
on_install(function (package)
|
|
|
- os.cp("./googletest/include", package:installdir())
|
|
|
+ io.writefile("xmake.lua", [[
|
|
|
+ target("gtest")
|
|
|
+ set_kind("static")
|
|
|
+ add_files("googletest/src/gtest-all.cc")
|
|
|
+ add_includedirs("googletest/include", "googletest")
|
|
|
+ add_headerfiles("googletest/include/(**.h)")
|
|
|
+ ]])
|
|
|
+ import("package.tools.xmake").install(package)
|
|
|
end)
|
|
|
|
|
|
on_test(function (package)
|
|
|
assert(package:check_cxxsnippets({test = [[
|
|
|
int factorial(int number) { return number <= 1 ? number : factorial(number - 1) * number; }
|
|
|
TEST(FactorialTest, Zero) {
|
|
|
+ testing::InitGoogleTest(0, (char**)0);
|
|
|
EXPECT_EQ(1, factorial(1));
|
|
|
EXPECT_EQ(2, factorial(2));
|
|
|
EXPECT_EQ(6, factorial(3));
|