Implemented out of source build.

This commit is contained in:
Vitaly Zaitsev 2020-07-08 13:59:57 +02:00
parent cdcfe58baa
commit c52e6c758b
No known key found for this signature in database
GPG Key ID: BF99FC6DD45AB90A

View File

@ -1,3 +1,5 @@
%undefine __cmake_in_source_build
%bcond_without doc
Name: fmt
Version: 7.0.1
@ -18,6 +20,7 @@ Patch8: doc-build-use-python3.patch
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: ninja-build
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: cmake3
%else
@ -70,15 +73,14 @@ This package contains documentation for developer documentation for %{name}.
%prep
%autosetup -p1
mkdir build
%build
pushd build
%if 0%{?rhel} && 0%{?rhel} <= 7
%cmake3 .. \
%cmake3 \
%else
%cmake .. \
%cmake \
%endif
-G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DFMT_CMAKE_DIR=%{_datadir}/cmake/%{name} \
@ -86,19 +88,17 @@ pushd build
%if %{with doc}
# Remove --clean-css since that plugin isn't available
sed -i "s/'--clean-css',//" ../doc/build.py
%make_build all doc
sed -i "s/'--clean-css',//" doc/build.py
%cmake_build --target all --target doc
# Remove temporary build products
rm -rf ../build/doc/html/{.buildinfo,.doctrees,objects.inv}
rm -rf %{_vpath_builddir}/doc/html/{.buildinfo,.doctrees,objects.inv}
%endif
%install
%make_install -C build
%cmake_install
%check
pushd build
ctest -VV %{?_smp_mflags}
popd
%ctest
%files
%license LICENSE.rst