Skip to content

Commit fb741dd

Browse files
Michael Carrollchapulinascpeters
authored
Fix pybind11 compilation on focal/clang12 combo (#400)
Signed-off-by: Michael Carroll <michael@openrobotics.org> Co-authored-by: Louise Poubel <louise@openrobotics.org> Co-authored-by: Steve Peters <scpeters@openrobotics.org>
1 parent ed2300a commit fb741dd

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/python_pybind11/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ target_link_libraries(math PRIVATE
5151
${PROJECT_LIBRARY_TARGET_NAME}
5252
)
5353

54+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
55+
# Workaround for Clang and pybind11 on Focal
56+
# https://github.com/pybind/pybind11/issues/1604
57+
# Resolved by newer versions of pybind11
58+
if(${pybind11_VERSION} VERSION_LESS "2.4.4")
59+
target_compile_options(math PRIVATE -fsized-deallocation)
60+
endif()
61+
62+
# Suppress warnings that clang misidentifies:
63+
# https://github.com/pybind/pybind11/issues/1893
64+
target_compile_options(math PRIVATE -Wno-self-assign-overloaded)
65+
endif()
66+
5467
if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION)
5568
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
5669
execute_process(

0 commit comments

Comments
 (0)