From 5c6a93c68627225e86653a6a54a3b4e2d09f42c4 Mon Sep 17 00:00:00 2001 From: Igor Raits Date: Jul 20 2020 15:59:44 +0000 Subject: Improve compatibility with new CMake macro Signed-off-by: Igor Raits --- diff --git a/csdiff.spec b/csdiff.spec index 05c1a05..20d08f1 100644 --- a/csdiff.spec +++ b/csdiff.spec @@ -1,3 +1,5 @@ +%undefine __cmake_in_source_build + # python3 is not available on RHEL <= 7 %if 0%{?fedora} || 0%{?rhel} > 7 %bcond_without python3 @@ -68,44 +70,40 @@ code scan defect lists to find out added or fixed defects. %build make version.cc -mkdir csdiff_build -cd csdiff_build -%cmake .. -DBUILD_PYCSDIFF=OFF -make %{?_smp_mflags} VERBOSE=yes +%cmake -DBUILD_PYCSDIFF=OFF +%cmake_build %if %{with python2} -mkdir ../csdiff_build_py2 -cd ../csdiff_build_py2 -%cmake .. -DPYTHON_EXECUTABLE=%{__python2} -make %{?_smp_mflags} VERBOSE=yes +%global _vpath_builddir %{_target_platform}-py2 +%cmake -DPYTHON_EXECUTABLE=%{__python2} +%cmake_build +%undefine _vpath_builddir %endif %if %{with python3} -mkdir ../csdiff_build_py3 -cd ../csdiff_build_py3 -%cmake .. \ +%global _vpath_builddir %{_target_platform}-py3 +%cmake \ -DPYTHON_EXECUTABLE=%{__python3} \ -DBOOST_PYTHON_LIB_NAME=boost_python%{python3_version_nodots} -make %{?_smp_mflags} VERBOSE=yes pycsdiff +%cmake_build --target pycsdiff +%undefine _vpath_builddir %endif %install %if %{with python2} mkdir -vp %{buildroot}%{python2_sitearch} -install -vm0644 csdiff_build_py2/pycsdiff.so %{buildroot}%{python2_sitearch} +install -vm0644 %{_target_platform}-py2/pycsdiff.so %{buildroot}%{python2_sitearch} %endif %if %{with python3} mkdir -vp %{buildroot}%{python3_sitearch} -install -vm0644 csdiff_build_py3/pycsdiff.so %{buildroot}%{python3_sitearch} +install -vm0644 %{_target_platform}-py3/pycsdiff.so %{buildroot}%{python3_sitearch} %endif -cd csdiff_build -make install DESTDIR="$RPM_BUILD_ROOT" +%cmake_install %check -cd csdiff_build -ctest %{?_smp_mflags} --output-on-failure +%ctest %files %{_bindir}/csdiff