see also
https://fedoraproject.org/wiki/Changes/CMake_to_do_out-of-source_builds
Signed-off-by: Kefu Chai <kchai@redhat.com>
env | sort
-mkdir build
-cd build
+%{?!_vpath_builddir:%global _vpath_builddir %{_target_platform}}
+
+# TODO: drop this step once we can use `cmake -B`
+mkdir -p %{_vpath_builddir}
+pushd %{_vpath_builddir}
cmake .. \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \
%make_build
%endif
+popd
+
%if 0%{with make_check}
%check
# run in-tree unittests
-cd build
+pushd %{_vpath_builddir}
ctest %{_smp_mflags}
+popd
%endif
%install
-pushd build
+pushd %{_vpath_builddir}
%make_install
# we have dropped sysvinit bits
rm -f %{buildroot}/%{_sysconfdir}/init.d/ceph