mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[build] CMake: add some compiler flags from native-utils (#6825)
This commit is contained in:
@@ -30,6 +30,10 @@ include(CPack)
|
||||
include(OptionValidation)
|
||||
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||
if(MSVC)
|
||||
add_compile_options(/Zc:__cplusplus)
|
||||
endif()
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/lib)
|
||||
|
||||
@@ -71,6 +71,8 @@ The following build options are available:
|
||||
* Set this option to the location of the archive of the OpenCV Java bindings (it should be called opencv-xxx.jar, with the x'es being version numbers). NOTE: set it to the LOCATION of the file, not the file itself!
|
||||
* `NO_WERROR` (OFF Default)
|
||||
* This option will disable the `-Werror` compilation flag for non-MSVC builds.
|
||||
* `WPILIB_TARGET_WARNINGS`
|
||||
* Add compiler flags to this option to customize compiler options like warnings.
|
||||
|
||||
## Build Setup
|
||||
|
||||
|
||||
@@ -134,7 +134,11 @@ if(MSVC)
|
||||
else()
|
||||
target_compile_options(
|
||||
apriltag
|
||||
PRIVATE -Wno-sign-compare -Wno-gnu-zero-variadic-macro-arguments -Wno-type-limits
|
||||
PRIVATE
|
||||
-Wno-sign-compare
|
||||
-Wno-gnu-zero-variadic-macro-arguments
|
||||
-Wno-type-limits
|
||||
-Wno-format-nonliteral
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ macro(wpilib_target_warnings target)
|
||||
-pedantic
|
||||
-Wextra
|
||||
-Wno-unused-parameter
|
||||
-Wformat=2
|
||||
${WPILIB_TARGET_WARNINGS}
|
||||
)
|
||||
if(NOT NO_WERROR)
|
||||
|
||||
@@ -151,7 +151,7 @@ target_compile_features(wpiutil PUBLIC cxx_std_20)
|
||||
if(MSVC)
|
||||
target_compile_options(
|
||||
wpiutil
|
||||
PUBLIC /permissive- /Zc:preprocessor /Zc:throwingNew /MP /bigobj
|
||||
PUBLIC /permissive- /Zc:preprocessor /Zc:__cplusplus /Zc:throwingNew /MP /bigobj /utf-8
|
||||
)
|
||||
target_compile_definitions(wpiutil PRIVATE -D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user