diff options
author | Dmitry Marakasov <amdmi3@amdmi3.ru> | 2011-08-01 22:17:32 +0400 |
---|---|---|
committer | Dmitry Marakasov <amdmi3@amdmi3.ru> | 2011-08-01 22:17:32 +0400 |
commit | 318a730c459a8524d7030d261946c35815dd4b29 (patch) | |
tree | b423ef7463f889998e892a81b12336aca2bdcd91 | |
parent | 9017c51e7fee6b1da3d0309a7a8d151ae96646ec (diff) | |
download | minetest-318a730c459a8524d7030d261946c35815dd4b29.tar.gz minetest-318a730c459a8524d7030d261946c35815dd4b29.tar.bz2 minetest-318a730c459a8524d7030d261946c35815dd4b29.zip |
Check whether -Wno-unused-but-set-variable is supported before using
it. It seems to only be available on recent (>=4.6) versions of gcc.
-rw-r--r-- | src/CMakeLists.txt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ce53651b0..5bdfc7eee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -209,6 +209,8 @@ endif(BUILD_SERVER) # Set some optimizations and tweaks # +include(CheckCCompilerFlag) + if(MSVC) # Visual Studio @@ -236,7 +238,10 @@ else() endif() if(NOT APPLE) - set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-but-set-variable") + check_c_compiler_flag("-Wno-unused-but-set-variable" HAS_UNUSED_BUT_SET_VARIABLE_WARNING) + if(HAS_UNUSED_BUT_SET_VARIABLE_WARNING) + set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-but-set-variable") + endif(HAS_UNUSED_BUT_SET_VARIABLE_WARNING) endif() if(APPLE) |