303c3d7aff
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=170
48 lines
1.9 KiB
Plaintext
48 lines
1.9 KiB
Plaintext
#
|
|
# Macros for cmake
|
|
#
|
|
%__cmake %{_bindir}/cmake
|
|
%__ctest %{_bindir}/ctest
|
|
|
|
%cmake \
|
|
find . -name CMakeLists.txt \\\
|
|
-exec sed -i -re '/^[[:blank:]]*[sS][eE][tT][[:blank:]]*\\\([[:blank:]]*(CMAKE_BUILD_TYPE|CMAKE_COLOR_MAKEFILE|CMAKE_INSTALL_PREFIX|CMAKE_VERBOSE_MAKEFILE).*\\\)/{s/^/#IGNORE /}' {} + \
|
|
mkdir -p build \
|
|
cd build \
|
|
%__cmake .. \\\
|
|
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
|
|
-DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \\\
|
|
-DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\
|
|
-DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
|
|
-DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\
|
|
-DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\\
|
|
-DCMAKE_BUILD_TYPE=None \\\
|
|
-DCMAKE_C_FLAGS="${CFLAGS:-%optflags} -DNDEBUG" \\\
|
|
-DCMAKE_CXX_FLAGS="${CXXFLAGS:-%optflags} -DNDEBUG" \\\
|
|
-DCMAKE_Fortran_FLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}} -DNDEBUG" \\\
|
|
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \\\
|
|
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \\\
|
|
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \\\
|
|
%if "%{?_lib}" == "lib64" \
|
|
-DLIB_SUFFIX=64 \\\
|
|
%endif \
|
|
-DCMAKE_SKIP_RPATH:BOOL=ON \\\
|
|
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \\\
|
|
-DBUILD_SHARED_LIBS:BOOL=ON \\\
|
|
-DBUILD_STATIC_LIBS:BOOL=OFF \\\
|
|
-DCMAKE_COLOR_MAKEFILE:BOOL=OFF \\\
|
|
-DCMAKE_INSTALL_DO_STRIP:BOOL=OFF \\\
|
|
-DCMAKE_MODULES_INSTALL_DIR=%{_datadir}/cmake/Modules \\\
|
|
-DCMAKE_USER_MAKE_RULES_OVERRIDE="%{_datadir}/cmake/Modules/opensuse_rules.cmake"
|
|
|
|
%make_jobs \
|
|
%__make %{?_smp_mflags} VERBOSE=1
|
|
|
|
%cmake_install \
|
|
%__make VERBOSE=1 DESTDIR=%{buildroot} install/fast -C build
|
|
|
|
%ctest \
|
|
cd build \
|
|
%__ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags} \
|
|
cd ..
|