summaryrefslogtreecommitdiffstats
path: root/SetFlags.cmake
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-10-05 14:09:42 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-12-18 22:03:40 +0100
commit090d8305e4e3c3ee085a897b72f2b4708e183eb8 (patch)
treee703cc7fcb7f16c85f16b094d5df0bd0a8d698e8 /SetFlags.cmake
parentHorsies: don't always broadcast metadata (diff)
downloadcuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar
cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.gz
cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.bz2
cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.lz
cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.xz
cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.zst
cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.zip
Diffstat (limited to 'SetFlags.cmake')
-rw-r--r--SetFlags.cmake36
1 files changed, 20 insertions, 16 deletions
diff --git a/SetFlags.cmake b/SetFlags.cmake
index f5c8a282b..ff1b4bad4 100644
--- a/SetFlags.cmake
+++ b/SetFlags.cmake
@@ -111,14 +111,6 @@ function(set_global_flags)
endif()
endfunction()
-function (try_add_flag TARGET FLAG)
- include(CheckCXXCompilerFlag)
- check_cxx_compiler_flag("${FLAG}" "HAS_FLAG_${FLAG}")
- if ("${HAS_FLAG_${FLAG}}")
- target_compile_options(${TARGET} PRIVATE "${FLAG}")
- endif()
-endfunction()
-
function(set_exe_flags TARGET)
if (MSVC)
# TODO: MSVC level 4, warnings as errors
@@ -158,15 +150,27 @@ function(set_exe_flags TARGET)
-Wno-switch-enum
# Weverything with Clang exceptions:
- -Weverything -Wno-error=disabled-macro-expansion -Wno-weak-vtables
- -Wno-exit-time-destructors -Wno-string-conversion -Wno-c++98-compat-pedantic
- -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro
- -Wno-error=unused-command-line-argument
+ -Weverything -Wno-exit-time-destructors -Wno-error=disabled-macro-expansion
+ -Wno-weak-vtables -Wno-string-conversion -Wno-c++98-compat-pedantic -Wno-documentation
+ -Wno-documentation-unknown-command -Wno-reserved-id-macro -Wno-error=unused-command-line-argument
)
- # We aren't using C++11
- try_add_flag(${TARGET} -Wno-return-std-move-in-c++11)
- # int to float conversions happen a lot, not worth fixing all warnings
- try_add_flag(${TARGET} -Wno-implicit-int-float-conversion)
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7)
+ target_compile_options(
+ ${TARGET} PRIVATE
+
+ # We aren't using C++11:
+ -Wno-return-std-move-in-c++11
+ )
+ endif()
+
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
+ target_compile_options(
+ ${TARGET} PRIVATE
+
+ # int to float conversions happen a lot, not worth fixing all warnings:
+ -Wno-implicit-int-float-conversion
+ )
+ endif()
endif()
endfunction()