Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion cmake/GzCodeCoverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ IF(NOT CMAKE_COMPILER_IS_GNUCXX)
# Clang version 3.0.0 and greater now supports gcov as well.
MESSAGE(WARNING "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.")

IF(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
IF(NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang"))
MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
ENDIF()
ENDIF() # NOT CMAKE_COMPILER_IS_GNUCXX
Expand Down
11 changes: 10 additions & 1 deletion cmake/GzSetCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ macro(_gz_set_compiler_flags)
endif()

# Check if we are compiling with Clang with GNU-like flags and cache it
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
set(CLANG false)
else()
Expand Down Expand Up @@ -128,6 +128,15 @@ macro(_gz_setup_gcc_or_clang)
-Wshadow -Winit-self -Wswitch-default -Wmissing-include-dirs -pedantic
)

if(CLANG)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The scope of the change seems to me too open to discard a warning in a given gz-physics compilation unit. Unless more gz libraries are affected I would bring this into gz-physics code itself.

# Suppress warning about variadic macro arguments in gtest.
# This is needed for tests in gz-physics on macOS.
_gz_filter_valid_compiler_options(
CUSTOM_ALL_FLAGS
-Wno-variadic-macro-arguments-omitted
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clang++ -Wno-variadic-macro-arguments-omitted foo.cc 
warning: unknown warning option '-Wno-variadic-macro-arguments-omitted' [-Wunknown-warning-option]

In linux clang++ 18.1.3 the flag is not recognized. Maybe -Wgnu-zero-variadic-macro-arguments ?

)
endif()

# -ggdb3: Produce comprehensive debug information that can be utilized by gdb
set(CUSTOM_DEBUG_FLAGS "-ggdb3")

Expand Down
Loading