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

disable warnings in third-party code #281

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
15 changes: 13 additions & 2 deletions profiling/perfetto-connector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
kp_add_library(kp_perfetto_connector libperfetto-connector.cpp perfetto/perfetto.cc)
target_include_directories(kp_perfetto_connector PRIVATE perfetto)
# perfetto/perfetto.cc is third-party code, so we want to disable all warnings for it
add_library(perfetto_static STATIC perfetto/perfetto.cc)
set_target_properties(perfetto_static PROPERTIES POSITION_INDEPENDENT_CODE ON)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Comment on lines +2 to +3
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we built the library explicitly as static with fpic instead of shared?

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 figured it was less opportunity for something to go wrong during the build. I don't have a strong opinion.

target_compile_options(perfetto_static PRIVATE -w)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(perfetto_static PRIVATE /w)
endif()

kp_add_library(kp_perfetto_connector libperfetto-connector.cpp)
target_link_libraries(kp_perfetto_connector PRIVATE perfetto_static)

# mark as system so we don't get warnings from perfetto.h either
target_include_directories(kp_perfetto_connector PRIVATE SYSTEM perfetto)
Loading