Simplify doctest download workaround

This commit is contained in:
Benjamin A. Beasley 2022-04-25 07:54:26 -04:00
parent 74cb6fd2dd
commit bae3d56b98

View File

@ -55,24 +55,26 @@ applications that use c4fs.
%autosetup -n c4fs-%{commit} -p1
# Remove/unbundle additional dependencies
# c4project (CMake build scripts)
rm -rvf ext/c4core/cmake
cp -rvp %{_datadir}/cmake/c4project ext/c4core/cmake
# Patch out download of doctest:
awk '/^ if\(_DOCTEST\)$/ { x=1 }
x != 1
x == 1 && /^ endif\(\)$/ { x=0 }' \
'%{_datadir}/cmake/c4project/c4Project.cmake' \
> 'ext/c4core/cmake/c4Project.cmake'
# This comment fixes confused vim syntax highlighting: '
find ext
cp -rp '%{_datadir}/cmake/c4project' ext/c4core/cmake
# Do not try to link against a nonexistent doctest library (doctest is
# header-only, and we do not have the complete CMake project for doctest that
# would provide a target that knows this):
sed -r -i 's/\bdoctest\b//' test/CMakeLists.txt
sed -r -i \
-e 's/(LIBS.*)\bdoctest\b/\1/' \
-e 's/(c4_setup_testing\()DOCTEST\)/\1\)/' \
test/CMakeLists.txt
%build
%cmake -DC4FS_BUILD_TESTS=ON -GNinja
# We can stop the CMake scripts from downloading doctest by setting
# C4FS_CACHE_DOWNLOAD_DOCTEST to any directory that exists.
%cmake -GNinja \
-DC4FS_CACHE_DOWNLOAD_DOCTEST:PATH=/ \
-DC4FS_BUILD_TESTS=ON
%cmake_build