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