-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
PROJECT(capi-context-motion)
INCLUDE(GNUInstallDirs)
%description
Tizen Native Motion Recognition API
+%if "%{gcov}" == "0"
+%global gcov 0
+%else
+%{?gcov: %global gcov 1}
+%{!?gcov: %global gcov 0}
+%endif
+
%prep
%setup -q
%build
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%if 0%{?gcov:1}
+%if %{gcov}
export CFLAGS+=" -fprofile-arcs -ftest-coverage"
export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
export FFLAGS+=" -fprofile-arcs -ftest-coverage"
%cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version}
make %{?_smp_mflags}
-%if 0%{?gcov:1}
+%if %{gcov}
mkdir -p gcov-obj
find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
%endif
%install
%make_install
-%if 0%{?gcov:1}
-mkdir -p %{buildroot}%{_datadir}/gcov/obj
-install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
+%if %{gcov}
+mkdir -p %{buildroot}%{_datadir}/gcov/obj/%{name}
+install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj/%{name}
%endif
# For backward compatibility
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
-%if 0%{?gcov:1}
+%if %{gcov}
%package gcov
Summary: Tizen Native Motion Recognition API (gcov)
Group: Service Framework/Testing
+BuildRequires: tar
%description gcov
gcov objects for coverage test