diff --git a/cmake/MujocoOptions.cmake b/cmake/MujocoOptions.cmake index e9bfc04c..998b966f 100644 --- a/cmake/MujocoOptions.cmake +++ b/cmake/MujocoOptions.cmake @@ -93,7 +93,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang -Wno-int-in-bool-context -Wno-sign-compare -Wno-unknown-pragmas - -Wgnu-empty-initializer ) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # Set -Wimplicit-fallthrough=5 to only allow fallthrough annotation via __attribute__. @@ -101,6 +100,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang -Wno-maybe-uninitialized ) endif() + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT MSVC) + set(EXTRA_COMPILE_OPTIONS ${EXTRA_COMPILE_OPTIONS} -Wgnu-empty-initializer) + endif() endif() if(WIN32) diff --git a/sample/cmake/SampleOptions.cmake b/sample/cmake/SampleOptions.cmake index e9bfc04c..998b966f 100644 --- a/sample/cmake/SampleOptions.cmake +++ b/sample/cmake/SampleOptions.cmake @@ -93,7 +93,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang -Wno-int-in-bool-context -Wno-sign-compare -Wno-unknown-pragmas - -Wgnu-empty-initializer ) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # Set -Wimplicit-fallthrough=5 to only allow fallthrough annotation via __attribute__. @@ -101,6 +100,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang -Wno-maybe-uninitialized ) endif() + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT MSVC) + set(EXTRA_COMPILE_OPTIONS ${EXTRA_COMPILE_OPTIONS} -Wgnu-empty-initializer) + endif() endif() if(WIN32) diff --git a/simulate/cmake/SimulateOptions.cmake b/simulate/cmake/SimulateOptions.cmake index e9bfc04c..998b966f 100644 --- a/simulate/cmake/SimulateOptions.cmake +++ b/simulate/cmake/SimulateOptions.cmake @@ -93,7 +93,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang -Wno-int-in-bool-context -Wno-sign-compare -Wno-unknown-pragmas - -Wgnu-empty-initializer ) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # Set -Wimplicit-fallthrough=5 to only allow fallthrough annotation via __attribute__. @@ -101,6 +100,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang -Wno-maybe-uninitialized ) endif() + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT MSVC) + set(EXTRA_COMPILE_OPTIONS ${EXTRA_COMPILE_OPTIONS} -Wgnu-empty-initializer) + endif() endif() if(WIN32)