Support non-gtest NATIVE_TESTS
We've had this in Soong for a while, but never supported it in Make.
Bug: 33819328
Test: Change LOCAL_GTEST on a module, check m -j ... showcommands
Change-Id: Id8f4b9908c82c05d9a986a38945b33bac578e991
diff --git a/core/host_test_internal.mk b/core/host_test_internal.mk
index 473815b..ffb22c7 100644
--- a/core/host_test_internal.mk
+++ b/core/host_test_internal.mk
@@ -2,15 +2,17 @@
## Shared definitions for all host test compilations.
#####################################################
-LOCAL_CFLAGS_windows += -DGTEST_OS_WINDOWS
-LOCAL_CFLAGS_linux += -DGTEST_OS_LINUX
-LOCAL_LDLIBS_linux += -lpthread
-LOCAL_CFLAGS_darwin += -DGTEST_OS_MAC
-LOCAL_LDLIBS_darwin += -lpthread
+ifeq ($(LOCAL_GTEST),true)
+ LOCAL_CFLAGS_windows += -DGTEST_OS_WINDOWS
+ LOCAL_CFLAGS_linux += -DGTEST_OS_LINUX
+ LOCAL_LDLIBS_linux += -lpthread
+ LOCAL_CFLAGS_darwin += -DGTEST_OS_MAC
+ LOCAL_LDLIBS_darwin += -lpthread
-LOCAL_CFLAGS += -DGTEST_HAS_STD_STRING -O0 -g
+ LOCAL_CFLAGS += -DGTEST_HAS_STD_STRING -O0 -g
-LOCAL_STATIC_LIBRARIES += libgtest_main_host libgtest_host
+ LOCAL_STATIC_LIBRARIES += libgtest_main_host libgtest_host
+endif
ifdef LOCAL_MODULE_PATH
$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH when building test $(LOCAL_MODULE))