aports/testing/valhalla/0003-disable-werror.patch
2021-03-13 12:05:33 +00:00

125 lines
4.5 KiB
Diff

From d658151cbed872f3606c5c3dfce4583c0c083133 Mon Sep 17 00:00:00 2001
From: Bart Ribbers <bribbers@disroot.org>
Date: Fri, 12 Mar 2021 13:25:23 +0100
Subject: [PATCH] Allow disabling Werror
Mainly useful for distribution packaging where we don't care about
warnings as long as the resulting package works properly. Make sure it
defaults to ON so packaging will have to turn it OFF and warnings
won't accidentally be missed
---
CMakeLists.txt | 2 ++
src/CMakeLists.txt | 2 +-
src/baldr/CMakeLists.txt | 2 +-
src/loki/CMakeLists.txt | 2 +-
src/sif/CMakeLists.txt | 2 +-
src/thor/CMakeLists.txt | 2 +-
test/CMakeLists.txt | 2 +-
test/gurka/CMakeLists.txt | 2 +-
9 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e612dbd7..c807a28f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,6 +34,8 @@ option(ENABLE_WERROR "Convert compiler warnings to errors. Requires ENABLE_COMPI
option(ENABLE_BENCHMARKS "Enable microbenchmarking" ON)
option(ENABLE_THREAD_SAFE_TILE_REF_COUNT "If ON tiles reference counters are thread safe" OFF)
+option(ENABLE_WERROR "Let warnings be treated as errors" ON)
+
set(LOGGING_LEVEL "" CACHE STRING "Logging level, default is INFO")
set_property(CACHE LOGGING_LEVEL PROPERTY STRINGS "NONE;ALL;ERROR;WARN;INFO;DEBUG;TRACE")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0ef57e872..e9465b2fd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -175,7 +175,7 @@ set(valhalla_src
${valhalla_hdrs}
${libvalhalla_link_objects})
-if (UNIX)
+if (UNIX AND ENABLE_WERROR)
# Enables stricter compiler checks on a file-by-file basis
# which allows us to migrate piecemeal
set_source_files_properties(proto_conversions.cc PROPERTIES COMPILE_FLAGS "-Wall -Werror")
diff --git a/src/baldr/CMakeLists.txt b/src/baldr/CMakeLists.txt
index e53d3f6e6..234c7bfe5 100644
--- a/src/baldr/CMakeLists.txt
+++ b/src/baldr/CMakeLists.txt
@@ -90,7 +90,7 @@ list(APPEND sources
${CMAKE_CURRENT_BINARY_DIR}/date_time_windows_zones.h
tz_alt.cpp)
-if (UNIX)
+if (UNIX AND ENABLE_WERROR)
# Enables stricter compiler checks on a file-by-file basis
# which allows us to migrate piecemeal
set_source_files_properties(openlr.cc PROPERTIES COMPILE_FLAGS "-Werror")
diff --git a/src/loki/CMakeLists.txt b/src/loki/CMakeLists.txt
index da3426870..d6bd21d24 100644
--- a/src/loki/CMakeLists.txt
+++ b/src/loki/CMakeLists.txt
@@ -15,7 +15,7 @@ set(sources
node_search.cc
polygon_search.cc)
-if (UNIX AND NOT APPLE)
+if (UNIX AND NOT APPLE AND ENABLE_WERROR)
# Enables stricter compiler checks on a file-by-file basis
# which allows us to migrate piecemeal
set_source_files_properties(
diff --git a/src/sif/CMakeLists.txt b/src/sif/CMakeLists.txt
index ef5dcaa1f..4b605d8e3 100644
--- a/src/sif/CMakeLists.txt
+++ b/src/sif/CMakeLists.txt
@@ -13,7 +13,7 @@ set(sources
dynamiccost.cc
recost.cc)
-if (UNIX)
+if (UNIX AND ENABLE_WERROR)
# Enables stricter compiler checks on a file-by-file basis
# which allows us to migrate piecemeal
set_source_files_properties(${sources} PROPERTIES COMPILE_FLAGS "-Werror")
diff --git a/src/thor/CMakeLists.txt b/src/thor/CMakeLists.txt
index 93d6645fd..134a8953c 100644
--- a/src/thor/CMakeLists.txt
+++ b/src/thor/CMakeLists.txt
@@ -28,7 +28,7 @@ set(sources
triplegbuilder_utils.h
worker.cc)
-if (UNIX AND NOT APPLE)
+if (UNIX AND NOT APPLE AND ENABLE_WERROR)
# Enables stricter compiler checks on a file-by-file basis
# which allows us to migrate piecemeal
set_source_files_properties(
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 7f88448df..127a52d91 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -48,7 +48,7 @@ if(NOT APPLE)
list(APPEND tests narrativebuilder util_odin)
endif()
-if (UNIX)
+if (UNIX AND ENABLE_WERROR)
# Enables stricter compiler checks on a file-by-file basis
# which allows us to migrate piecemeal
set_source_files_properties(
diff --git a/test/gurka/CMakeLists.txt b/test/gurka/CMakeLists.txt
index 6c556a569..fb3ced914 100644
--- a/test/gurka/CMakeLists.txt
+++ b/test/gurka/CMakeLists.txt
@@ -6,7 +6,7 @@ if(ENABLE_DATA_TOOLS)
add_custom_target(run-gurka)
set_target_properties(run-gurka PROPERTIES FOLDER "Tests")
- if (UNIX)
+ if (UNIX AND ENABLE_WERROR)
# Enables stricter compiler checks on a file-by-file basis
# which allows us to migrate piecemeal
set_source_files_properties(