blob: 8f5d54ea6c9c037f16941c5709b581effc0fc837 [file] [log] [blame]
Brian Silverman8fce7482020-01-05 13:18:21 -08001macro(wpilib_target_warnings target)
2 if(NOT MSVC)
James Kuszmaulcf324122023-01-14 14:07:17 -08003 target_compile_options(${target} PRIVATE -Wall -pedantic -Wextra -Werror -Wno-unused-parameter ${WPILIB_TARGET_WARNINGS})
Brian Silverman8fce7482020-01-05 13:18:21 -08004 else()
James Kuszmaulcf324122023-01-14 14:07:17 -08005 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 Silverman8fce7482020-01-05 13:18:21 -080014 endif()
James Kuszmaulb13e13f2023-11-22 20:44:04 -080015
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 Silverman8fce7482020-01-05 13:18:21 -080028endmacro()