Add initial code for GTest
[platform/core/connectivity/zigbee-manager.git] / packaging / zigbee-manager.spec
index 44ef413..6a2b4c5 100644 (file)
@@ -18,6 +18,11 @@ BuildRequires:  pkgconfig(gio-2.0)
 BuildRequires:  pkgconfig(gio-unix-2.0)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(vconf)
+
+%if 0%{?gtests:1}
+BuildRequires:  pkgconfig(gmock)
+%endif
+
 # if image creater does not know 'network_fw'
 Requires: security-config
 
@@ -52,10 +57,16 @@ cp -a %{SOURCE2} .
 %endif
 
 %build
+%if 0%{?gcov:1}
+export LDFLAGS+=" -lgcov"
+%endif
+
 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
        -DVERSION=%{version} \
        -DLIB_INSTALL_DIR=%{_libdir} \
        -DUNIT_INSTALL_DIR=%{_unitdir} \
+       -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \
+       -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0}
 
 make %{?_smp_mflags}
 
@@ -88,6 +99,9 @@ cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf
 %{_datadir}/dbus-1/system.d/zigbee.conf
 %endif
 %license LICENSE
+%if 0%{?gtests:1}
+%{_bindir}/gtest*
+%endif
 
 %files -n zigbee-lib
 %defattr(644,system,system,-)