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