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

Silent compiler warnings via -isystem includes #102

Open
wants to merge 1 commit into
base: melodic-devel
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
10 changes: 9 additions & 1 deletion cmake/sip_helper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ function(build_sip_binding PROJECT_NAME SIP_FILE)

set(SIP_BUILD_DIR ${sip_BINARY_DIR}/sip/${PROJECT_NAME})

set(INCLUDE_DIRS ${${PROJECT_NAME}_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})
set(INCLUDE_DIRS)
foreach(dir ${${PROJECT_NAME}_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})
get_filename_component(dir_real "${dir}" REALPATH BASE_DIR ${sip_SOURCE_DIR})
# filter out /usr/include, which must not be included via -isystem
if (NOT "${dir_real}" STREQUAL "/usr/include")
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why filtering /usr/include is necessary, but I'm willing to try it in Noetic and see if it causes issues.

list(APPEND INCLUDE_DIRS ${dir_real})
endif()
endforeach()
set(LIBRARY_DIRS ${${PROJECT_NAME}_LIBRARY_DIRS})
set(LDFLAGS_OTHER ${${PROJECT_NAME}_LDFLAGS_OTHER})

Expand All @@ -92,6 +99,7 @@ function(build_sip_binding PROJECT_NAME SIP_FILE)
add_custom_command(
OUTPUT ${SIP_BUILD_DIR}/Makefile
COMMAND ${PYTHON_EXECUTABLE} ${sip_SIP_CONFIGURE} ${SIP_BUILD_DIR} ${SIP_FILE} ${sip_LIBRARY_DIR} \"${INCLUDE_DIRS}\" \"${LIBRARIES}\" \"${LIBRARY_DIRS}\" \"${LDFLAGS_OTHER}\" \"${EXTRA_DEFINES}\"
COMMAND sed -i 's/ -I/ -isystem/g' ${SIP_BUILD_DIR}/Makefile
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there are windows users, and it seems like requiring sed would be a problem there. Can we do this in sip_configure.py after generating the makefile?

Copy link
Contributor Author

@rhaschke rhaschke Apr 13, 2021

Choose a reason for hiding this comment

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

Sure that will be possible. But, I will not have cycles to do that in any near future. I am using the present patch since several months already and just barely managed to file the PR now.

DEPENDS ${sip_SIP_CONFIGURE} ${SIP_FILE} ${sip_DEPENDS}
WORKING_DIRECTORY ${sip_SOURCE_DIR}
COMMENT "Running SIP generator for ${PROJECT_NAME} Python bindings..."
Expand Down