aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorselsta <selsta@sent.at>2021-05-12 21:32:51 +0200
committerselsta <selsta@sent.at>2021-05-12 21:55:32 +0200
commit9c0e681dc9d3a5791ce03ca4005afe9d13727e75 (patch)
tree34904fecd94ccb99a312ce5276fc29dfb0741d38 /CMakeLists.txt
parentMerge pull request #7669 (diff)
downloadmonero-9c0e681dc9d3a5791ce03ca4005afe9d13727e75.tar.xz
cmake: treat warnings as error in compiler flag tests
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt10
1 files changed, 6 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e858b3aaf..9878a61db 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,16 +106,18 @@ function (die msg)
endfunction ()
function (add_c_flag_if_supported flag var)
- string(REPLACE "-" "_" supported ${flag}_c)
- check_c_compiler_flag(${flag} ${supported})
+ set(TMP "-Werror ${flag}")
+ string(REGEX REPLACE "[- ]" "_" supported ${TMP}_c)
+ check_c_compiler_flag(${TMP} ${supported})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()
endfunction()
function (add_cxx_flag_if_supported flag var)
- string(REPLACE "-" "_" supported ${flag}_cxx)
- check_cxx_compiler_flag(${flag} ${supported})
+ set(TMP "-Werror ${flag}")
+ string(REGEX REPLACE "[- ]" "_" supported ${TMP}_cxx)
+ check_cxx_compiler_flag(${TMP} ${supported})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()