Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cherry Pick] build:Extend Common Compile Settings to Protobuf #124

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions protobuf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@ if(${TRITON_COMMON_ENABLE_PROTOBUF})
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)

target_compile_options(
proto-library PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra -Wno-unused-parameter -Werror>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This options are responsible for:
-Wall - enable all warnings
-Wextra - enable extra warnings
-Wno-unused-parameter - can't find definition
-Werror - make all warnings as error

$<$<CXX_COMPILER_ID:MSVC>:/W0 /D_WIN32_WINNT=0x0A00 /EHsc /Zc:preprocessor>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These options are responsible for:

/W0 - provide all warnings
/D_WIN32_WINNT=0x0A00 - defines version of Windows that binary compiled for.
/EHsc - specific flag to manage exceptions
/Zc:preprocessor - conformance flag for C++ language standards.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe /W0 suppresses all warnings.

target_link_libraries(
proto-library
PRIVATE
common-compile-settings
)

set_target_properties(
Expand Down Expand Up @@ -136,11 +135,10 @@ if(${TRITON_COMMON_ENABLE_GRPC})
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)

target_compile_options(
grpc-service-library PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra -Wno-unused-parameter -Werror>
$<$<CXX_COMPILER_ID:MSVC>:/W0 /D_WIN32_WINNT=0x0A00 /EHsc /Zc:preprocessor>
target_link_libraries(
grpc-service-library
PRIVATE
common-compile-settings
)

set_target_properties(
Expand Down Expand Up @@ -193,11 +191,10 @@ if(${TRITON_COMMON_ENABLE_GRPC})
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)

target_compile_options(
grpc-health-library PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra -Wno-unused-parameter -Werror>
$<$<CXX_COMPILER_ID:MSVC>:/W0 /D_WIN32_WINNT=0x0A00 /EHsc /Zc:preprocessor>
target_link_libraries(
grpc-health-library
PRIVATE
common-compile-settings
)

set_target_properties(
Expand Down
Loading