ngompa / rpms / cmake

Forked from rpms/cmake 4 years ago
Clone
f58644
#
f58644
# Macros for cmake
f58644
#
f58644
%_cmake_lib_suffix64 -DLIB_SUFFIX=64
f58644
%_cmake_shared_libs -DBUILD_SHARED_LIBS:BOOL=ON
f58644
%_cmake_skip_rpath -DCMAKE_SKIP_RPATH:BOOL=ON
f58644
%_cmake_version @@CMAKE_VERSION@@
f58644
%__cmake /usr/bin/cmake
73d71f
%__ctest /usr/bin/ctest
73d71f
%__cmake_in_source_build 1
73d71f
%__cmake_builddir %{!?__cmake_in_source_build:%{_vpath_builddir}}%{?__cmake_in_source_build:.}
f58644
f58644
# - Set default compile flags
f58644
# - CMAKE_*_FLAGS_RELEASE are added *after* the *FLAGS environment variables
f58644
# and default to -O3 -DNDEBUG.  Strip the -O3 so we can override with *FLAGS
f58644
# - Turn on verbose makefiles so we can see and verify compile flags
f58644
# - Set default install prefixes and library install directories
f58644
# - Turn on shared libraries by default
f58644
%cmake \
f58644
%if 0%{?set_build_flags:1} \
f58644
  %set_build_flags \
f58644
%else \
f58644
  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
f58644
  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
f58644
  FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \
f58644
  FCFLAGS="${FCFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FCFLAGS ; \
f58644
  %{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} \
f58644
%endif \
f58644
  %__cmake \\\
73d71f
        %{!?__cmake_in_source_build:-S "%{_vpath_srcdir}"} \\\
73d71f
        %{!?__cmake_in_source_build:-B "%{__cmake_builddir}"} \\\
f58644
        -DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
f58644
        -DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
f58644
        -DCMAKE_Fortran_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
f58644
        -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \\\
f58644
        -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
f58644
        -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\
f58644
        -DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
f58644
        -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\
f58644
        -DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\\
f58644
%if "%{?_lib}" == "lib64" \
f58644
        %{?_cmake_lib_suffix64} \\\
f58644
%endif \
73d71f
        %{?_cmake_shared_libs}
73d71f
73d71f
%cmake_build \
73d71f
  %__cmake --build "%{__cmake_builddir}" %{?_smp_mflags} --verbose
73d71f
73d71f
%cmake_install \
73d71f
  DESTDIR="%{buildroot}" %__cmake --install "%{__cmake_builddir}"
73d71f
73d71f
%ctest(:-:) \
73d71f
  cd "%{__cmake_builddir}" \
73d71f
  %__ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags} %{**} \
73d71f
  cd -
73d71f
f58644
f58644
%cmake@@CMAKE_MAJOR_VERSION@@ %cmake
73d71f
%cmake@@CMAKE_MAJOR_VERSION@@_build %cmake_build
73d71f
%cmake@@CMAKE_MAJOR_VERSION@@_install %cmake_install
73d71f
%ctest@@CMAKE_MAJOR_VERSION@@ %ctest