diff --git a/cmake/MujocoOptions.cmake b/cmake/MujocoOptions.cmake index 2b0ce938..388a69a8 100644 --- a/cmake/MujocoOptions.cmake +++ b/cmake/MujocoOptions.cmake @@ -87,6 +87,7 @@ get_mujoco_extra_link_options(EXTRA_LINK_OPTIONS) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT MSVC)) set(EXTRA_COMPILE_OPTIONS -Wall -Werror) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # TODO: This should add to EXTRA_COMPILE_OPTIONS rather than overwrite it. set(EXTRA_COMPILE_OPTIONS -Wno-int-in-bool-context -Wno-maybe-uninitialized @@ -94,6 +95,12 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang -Wno-stringop-overflow -Wno-stringop-truncation ) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0") + # Needed for https://github.com/abseil/abseil-cpp/issues/1201, until a new + # version of abseil is released with the fix. + set(EXTRA_COMPILE_OPTIONS "${EXTRA_COMPILE_OPTIONS}" + -Wno-deprecated-builtins + ) endif() endif() diff --git a/python/mujoco/CMakeLists.txt b/python/mujoco/CMakeLists.txt index 73d70a4f..eec5d717 100644 --- a/python/mujoco/CMakeLists.txt +++ b/python/mujoco/CMakeLists.txt @@ -46,6 +46,12 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Cl add_compile_options(-fdata-sections -ffunction-sections) endif() +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0") + # Needed for https://github.com/abseil/abseil-cpp/issues/1201, until a new + # version of abseil is released with the fix. + add_compile_options(-Wno-deprecated-builtins) +endif() + include(MujocoLinkOptions) get_mujoco_extra_link_options(EXTRA_LINK_OPTIONS) add_link_options(${EXTRA_LINK_OPTIONS}) diff --git a/sample/cmake/SampleOptions.cmake b/sample/cmake/SampleOptions.cmake index 2b0ce938..388a69a8 100644 --- a/sample/cmake/SampleOptions.cmake +++ b/sample/cmake/SampleOptions.cmake @@ -87,6 +87,7 @@ get_mujoco_extra_link_options(EXTRA_LINK_OPTIONS) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT MSVC)) set(EXTRA_COMPILE_OPTIONS -Wall -Werror) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # TODO: This should add to EXTRA_COMPILE_OPTIONS rather than overwrite it. set(EXTRA_COMPILE_OPTIONS -Wno-int-in-bool-context -Wno-maybe-uninitialized @@ -94,6 +95,12 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang -Wno-stringop-overflow -Wno-stringop-truncation ) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0") + # Needed for https://github.com/abseil/abseil-cpp/issues/1201, until a new + # version of abseil is released with the fix. + set(EXTRA_COMPILE_OPTIONS "${EXTRA_COMPILE_OPTIONS}" + -Wno-deprecated-builtins + ) endif() endif() diff --git a/simulate/cmake/SimulateOptions.cmake b/simulate/cmake/SimulateOptions.cmake index 2b0ce938..388a69a8 100644 --- a/simulate/cmake/SimulateOptions.cmake +++ b/simulate/cmake/SimulateOptions.cmake @@ -87,6 +87,7 @@ get_mujoco_extra_link_options(EXTRA_LINK_OPTIONS) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT MSVC)) set(EXTRA_COMPILE_OPTIONS -Wall -Werror) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # TODO: This should add to EXTRA_COMPILE_OPTIONS rather than overwrite it. set(EXTRA_COMPILE_OPTIONS -Wno-int-in-bool-context -Wno-maybe-uninitialized @@ -94,6 +95,12 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang -Wno-stringop-overflow -Wno-stringop-truncation ) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0") + # Needed for https://github.com/abseil/abseil-cpp/issues/1201, until a new + # version of abseil is released with the fix. + set(EXTRA_COMPILE_OPTIONS "${EXTRA_COMPILE_OPTIONS}" + -Wno-deprecated-builtins + ) endif() endif()