Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 1 | macro(wpilib_target_warnings target) |
| 2 | if(NOT MSVC) |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 3 | target_compile_options(${target} PRIVATE -Wall -pedantic -Wextra -Werror -Wno-unused-parameter ${WPILIB_TARGET_WARNINGS}) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 4 | else() |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 5 | target_compile_options(${target} PRIVATE /wd4146 /wd4244 /wd4251 /wd4267 /WX /D_CRT_SECURE_NO_WARNINGS ${WPILIB_TARGET_WARNINGS}) |
| 6 | endif() |
| 7 | |
| 8 | # Suppress C++-specific OpenCV warning; C compiler rejects it with an error |
| 9 | # https://github.com/opencv/opencv/issues/20269 |
| 10 | if(UNIX AND NOT APPLE) |
| 11 | target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-enum-enum-conversion>) |
| 12 | elseif(UNIX AND APPLE) |
| 13 | target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-anon-enum-enum-conversion>) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 14 | endif() |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame] | 15 | |
| 16 | # Suppress warning "enumeration types with a fixed underlying type are a |
| 17 | # Clang extension" |
| 18 | if(APPLE) |
| 19 | target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-fixed-enum-extension>) |
| 20 | endif() |
| 21 | |
| 22 | # Compress debug info with GCC |
| 23 | if ((${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR |
| 24 | ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo") AND |
| 25 | ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") |
| 26 | target_compile_options(${target} PRIVATE -gz=zlib) |
| 27 | endif() |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 28 | endmacro() |