From 1d4832d63d17d79a723634510ddb4b03d4385dc5 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 15 Jan 2018 22:49:43 +0000 Subject: [PATCH] Use upstream patch to disable -Werror --- catch-werror.patch | 44 ++++++++++++++++++++++++++++++++++++++++++++ catch.spec | 7 +++---- 2 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 catch-werror.patch diff --git a/catch-werror.patch b/catch-werror.patch new file mode 100644 index 0000000..2cfebff --- /dev/null +++ b/catch-werror.patch @@ -0,0 +1,44 @@ +commit 07c84adfbaac181560ed79576848fda82da6311b +Author: Martin Hořeňovský +Date: Sun Jan 14 18:14:11 2018 +0100 + + Allow disabling -Werror in CMake + + Related to #1152 + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0fa91501..e0b2fc19 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,6 +5,7 @@ project(CatchSelfTest) + option(USE_VALGRIND "Perform SelfTests with Valgrind" OFF) + option(BUILD_EXAMPLES "Build documentation examples" OFF) + option(ENABLE_COVERAGE "Generate coverage for codecov.io" OFF) ++option(DISABLE_WERROR "Do not enable warnings as errors" OFF) + + set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +@@ -309,7 +310,10 @@ if (NOT NO_SELFTEST) + + # Add desired warnings + if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" ) +- target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code -Werror ) ++ target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code ) ++ if (NOT DISABLE_WERROR) ++ target_compile_options( SelfTest PRIVATE -Werror) ++ endif() + endif() + # Clang specific warning go here + if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) +@@ -318,7 +322,10 @@ if (NOT NO_SELFTEST) + endif() + if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) + STRING(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # override default warning level +- target_compile_options( SelfTest PRIVATE /w44265 /WX /w44061 /w44062 ) ++ target_compile_options( SelfTest PRIVATE /w44265 /w44061 /w44062 ) ++ if (NOT DISABLE_WERROR) ++ target_compile_options( SelfTest PRIVATE /WX) ++ endif() + endif() + + diff --git a/catch.spec b/catch.spec index 96f1a91..8441417 100644 --- a/catch.spec +++ b/catch.spec @@ -10,6 +10,8 @@ URL: https://github.com/philsquared/Catch Source0: https://github.com/philsquared/Catch/archive/v%{version}/%{name}-%{version}.tar.gz # https://github.com/catchorg/Catch2/commit/f0909dfe02df36e70c4c95ed00d53cb3eacf0262 Patch0001: 0001-Add-yet-another-expansion-of-INF-macro.patch +# https://github.com/catchorg/Catch2/commit/07c84adfbaac181560ed79576848fda82da6311b +Patch2: catch-werror.patch BuildRequires: cmake make gcc-c++ BuildRequires: %{_bindir}/python3 @@ -34,15 +36,12 @@ is packaged up as a single header for extra convenience. %prep %autosetup -p 1 -n Catch2-%{version} -# Putting -Werror always breaks when linters change and is bad for production -# https://github.com/catchorg/Catch2/issues/1152 -sed -i -e "s|-Werror\([^=]\)|\1|" CMakeLists.txt # No python, just python3 sed -i -e "s|COMMAND python |COMMAND %{_bindir}/python3 |" CMakeLists.txt %build -%cmake . -Bbuild +%cmake . -Bbuild -DDISABLE_WERROR=ON %make_build -Cbuild