summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2024-03-13 23:28:36 +0300
committerEd Tanous <ed@tanous.net>2024-03-25 21:29:19 +0300
commitade3f09309fa080022c538fa965e6ce9c3abda45 (patch)
treeae467bd79f1073b50770afbb9000219cb0325696 /meson.build
parenta07e9819fbf24f998643812566f3ec3cf3a2204d (diff)
downloadbmcweb-ade3f09309fa080022c538fa965e6ce9c3abda45.tar.xz
Require specific compiler versions
Quite often do I compile this project, and see an error message that makes no sense. Multiple times I've seen posted about compiler errors that amount to using an old version of clang or gcc. Explicitly require clang-17 and gcc-13 in the meson config, and give better errors if they're not present. This also allows simplifying our warning flags (which probably need a review soon) by making two sets of flags, one for each compiler. Note, clang has the -Weverything flag, which we use, so explicitly enabling warnings isn't really required, only disabling the ones that we don't use. Tested: Code compiles. Change-Id: I09fa74e6d36feaf05710a4bb7d266f80ff1cc592 Signed-off-by: Ed Tanous <ed@tanous.net>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build58
1 files changed, 26 insertions, 32 deletions
diff --git a/meson.build b/meson.build
index 2d5f00e8d5..0c5277e0e9 100644
--- a/meson.build
+++ b/meson.build
@@ -130,24 +130,13 @@ endif
# Add compiler arguments
-# -Wpedantic, -Wextra comes by default with warning level
-add_project_arguments(
- cxx.get_supported_arguments([
- '-Wcast-align',
- '-Wconversion',
- '-Wformat=2',
- '-Woverloaded-virtual',
- '-Wsign-conversion',
- '-Wunused',
- '-Wno-attributes',
- ]),
- language: 'cpp'
-)
-
-if (cxx.get_id() == 'clang' and cxx.version().version_compare('>9.0'))
-add_project_arguments(
- cxx.get_supported_arguments([
+if (cxx.get_id() == 'clang')
+ if (cxx.version().version_compare('<17.0'))
+ error('This project requires clang-17 or higher')
+ endif
+ add_project_arguments(
'-Weverything',
+ '-Wformat=2',
'-Wno-c++98-compat-pedantic',
'-Wno-c++98-compat',
'-Wno-documentation-unknown-command',
@@ -161,25 +150,30 @@ add_project_arguments(
'-Wno-weak-vtables',
'-Wno-switch-enum',
'-Wno-unused-macros',
- ]),
- language:'cpp')
+ language:'cpp')
endif
-# if compiler is gnu-gcc , and version is > 8.0 then we add few more
-# compiler arguments , we know that will pass
+if (cxx.get_id() == 'gcc')
+ if (cxx.version().version_compare('<13.0'))
+ error('This project requires gcc-13 or higher')
+ endif
-if (cxx.get_id() == 'gcc' and cxx.version().version_compare('>8.0'))
add_project_arguments(
- cxx.get_supported_arguments([
- '-Wduplicated-cond',
- '-Wduplicated-branches',
- '-Wlogical-op',
- '-Wnull-dereference',
- '-Wunused-parameter',
- '-Wdouble-promotion',
- '-Wshadow',
- '-Wno-psabi',
- ]),
+ '-Wformat=2',
+ '-Wcast-align',
+ '-Wconversion',
+ '-Woverloaded-virtual',
+ '-Wsign-conversion',
+ '-Wunused',
+ '-Wduplicated-cond',
+ '-Wduplicated-branches',
+ '-Wlogical-op',
+ '-Wnull-dereference',
+ '-Wunused-parameter',
+ '-Wdouble-promotion',
+ '-Wshadow',
+ '-Wno-psabi',
+ '-Wno-attributes',
language:'cpp')
endif