aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2021-07-27 16:54:36 -0400
committerluigi1111 <luigi1111w@gmail.com>2021-07-27 16:54:36 -0400
commit8a845f5dc85d7bdd6ae30269b8984e500ce9c235 (patch)
tree806c758607aa891ef9bf7b8c5a48515db0156ec6
parentMerge pull request #7698 (diff)
parentcmake: treat warnings as error in compiler flag tests (diff)
downloadmonero-8a845f5dc85d7bdd6ae30269b8984e500ce9c235.tar.xz
Merge pull request #7718
9c0e681 cmake: treat warnings as error in compiler flag tests (selsta)
-rw-r--r--CMakeLists.txt10
1 files changed, 6 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 339609e8c..f2cdc1818 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()