diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-27 04:00:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-27 04:00:36 +0800 |
commit | 6db13311dd6d9e9ebb10f6f5b34c5b326f69b390 (patch) | |
tree | c6901c73a0db6dd5ba9d7c2a8c41e757a90569c9 /cmake/EthCheckCXXCompilerFlag.cmake | |
parent | eb5a6aacd993e3782eaf0c0f9dbce03a0567512f (diff) | |
parent | 5722f3083cae829c28a28083fa806005ed71168c (diff) | |
download | dexon-solidity-6db13311dd6d9e9ebb10f6f5b34c5b326f69b390.tar dexon-solidity-6db13311dd6d9e9ebb10f6f5b34c5b326f69b390.tar.gz dexon-solidity-6db13311dd6d9e9ebb10f6f5b34c5b326f69b390.tar.bz2 dexon-solidity-6db13311dd6d9e9ebb10f6f5b34c5b326f69b390.tar.lz dexon-solidity-6db13311dd6d9e9ebb10f6f5b34c5b326f69b390.tar.xz dexon-solidity-6db13311dd6d9e9ebb10f6f5b34c5b326f69b390.tar.zst dexon-solidity-6db13311dd6d9e9ebb10f6f5b34c5b326f69b390.zip |
Merge pull request #2946 from ethereum/cmake
CMake: Add compiler warning about implicit fallthough
Diffstat (limited to 'cmake/EthCheckCXXCompilerFlag.cmake')
-rw-r--r-- | cmake/EthCheckCXXCompilerFlag.cmake | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cmake/EthCheckCXXCompilerFlag.cmake b/cmake/EthCheckCXXCompilerFlag.cmake new file mode 100644 index 00000000..c6ed35b4 --- /dev/null +++ b/cmake/EthCheckCXXCompilerFlag.cmake @@ -0,0 +1,23 @@ +include(CheckCXXCompilerFlag) + +# Adds CXX compiler flag if the flag is supported by the compiler. +# +# This is effectively a combination of CMake's check_cxx_compiler_flag() +# and add_compile_options(): +# +# if(check_cxx_compiler_flag(flag)) +# add_compile_options(flag) +# +function(eth_add_cxx_compiler_flag_if_supported FLAG) + # Remove leading - or / from the flag name. + string(REGEX REPLACE "^-|/" "" name ${FLAG}) + check_cxx_compiler_flag(${FLAG} ${name}) + if(${name}) + add_compile_options(${FLAG}) + endif() + + # If the optional argument passed, store the result there. + if(ARGV1) + set(${ARGV1} ${name} PARENT_SCOPE) + endif() +endfunction() |