Merge "cc_cmake_snapshot: fix cc_test and cc_benchmark" into main

This commit is contained in:
Tomasz Wasilczyk
2024-06-11 16:04:36 +00:00
committed by Gerrit Code Review

View File

@@ -489,16 +489,23 @@ func getModuleType(m *Module) string {
return "library" return "library"
case *testBinary: case *testBinary:
return "executable" return "executable"
case *benchmarkDecorator:
return "executable"
} }
panic(fmt.Sprintf("Unexpected module type: %T", m.compiler)) panic(fmt.Sprintf("Unexpected module type: %T", m.linker))
} }
func getExtraLibs(m *Module) []string { func getExtraLibs(m *Module) []string {
switch decorator := m.linker.(type) { switch decorator := m.linker.(type) {
case *testBinary: case *testBinary:
if decorator.testDecorator.gtest() { if decorator.testDecorator.gtest() {
return []string{"libgtest"} return []string{
"libgtest",
"libgtest_main",
}
} }
case *benchmarkDecorator:
return []string{"libgoogle-benchmark"}
} }
return nil return nil
} }