Add out-of-source builds controlled by a macro
This will allow us to port packages to the %cmake_build/%cmake_install even on older Fedora with possibility to easily opt-in for out-of-source builds by `%global __cmake_out_of_source_build 1`. In future we will make it opt-out (`%global __cmake_out_of_source_build 0` will do in-source builds again). Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
This commit is contained in:
parent
134e994816
commit
2af1671e51
@ -67,7 +67,7 @@
|
||||
|
||||
Name: %{orig_name}%{?name_suffix}
|
||||
Version: %{major_version}.%{minor_version}.0
|
||||
Release: 0.5%{?relsuf}%{?dist}
|
||||
Release: 0.6%{?relsuf}%{?dist}
|
||||
Summary: Cross-platform make system
|
||||
|
||||
# most sources are BSD
|
||||
@ -503,6 +503,9 @@ mv -f Modules/FindLibArchive.disabled Modules/FindLibArchive.cmake
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Jul 03 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 3.18.0-0.6.rc2
|
||||
- Add out-of-source builds controlled by a macro (%%__cmake_out_of_source_build)
|
||||
|
||||
* Wed Jul 01 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 3.18.0-0.5.rc2
|
||||
- Undo out-of-source-builds
|
||||
|
||||
|
12
macros.cmake
12
macros.cmake
@ -7,6 +7,8 @@
|
||||
%_cmake_version @@CMAKE_VERSION@@
|
||||
%__cmake /usr/bin/cmake
|
||||
%__ctest /usr/bin/ctest
|
||||
%__cmake_out_of_source_build 0
|
||||
%__cmake_builddir %[%{?__cmake_out_of_source_build} ? "%{_vpath_builddir}" : "."]
|
||||
|
||||
# - Set default compile flags
|
||||
# - CMAKE_*_FLAGS_RELEASE are added *after* the *FLAGS environment variables
|
||||
@ -25,6 +27,8 @@
|
||||
%{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} \
|
||||
%endif \
|
||||
%__cmake \\\
|
||||
-S "%{_vpath_srcdir}" \\\
|
||||
-B "%{__cmake_builddir}" \\\
|
||||
-DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
|
||||
-DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
|
||||
-DCMAKE_Fortran_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
|
||||
@ -37,16 +41,16 @@
|
||||
%if "%{?_lib}" == "lib64" \
|
||||
%{?_cmake_lib_suffix64} \\\
|
||||
%endif \
|
||||
%{?_cmake_shared_libs}
|
||||
%{?_cmake_shared_libs}
|
||||
|
||||
%cmake_build \
|
||||
%__cmake --build "%{_vpath_builddir}" %{?_smp_mflags} --verbose
|
||||
%__cmake --build "%{__cmake_builddir}" %{?_smp_mflags} --verbose
|
||||
|
||||
%cmake_install \
|
||||
DESTDIR="%{buildroot}" %__cmake --install "%{_vpath_builddir}"
|
||||
DESTDIR="%{buildroot}" %__cmake --install "%{__cmake_builddir}"
|
||||
|
||||
%ctest(:-:) \
|
||||
cd "%{_vpath_builddir}" \
|
||||
cd "%{__cmake_builddir}" \
|
||||
%__ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags} %{**} \
|
||||
cd -
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user