Skip to content

Commit 65381ee

Browse files
simpkinsfacebook-github-bot
authored andcommitted
only use -Wno-noexcept-type when it is supported
Summary: Update CMakeLists.txt to check if the compiler supports `-Wno-noexcept-type` before adding it to the compiler flags. This flag is required when building with gcc 7+, but is unsupported by clang. Reviewed By: phoad Differential Revision: D10408987 fbshipit-source-id: 444eeb9f122276c254696fcf5bc99e6b19a393ff
1 parent 3f00bd7 commit 65381ee

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,18 @@ set(GMOCK_LIBS
155155

156156
set(CMAKE_CXX_STANDARD 14)
157157

158+
include(CheckCXXCompilerFlag)
159+
158160
# Common configuration for all build modes.
159161
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
160-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-noexcept-type")
161162
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual")
162163
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
163164

165+
CHECK_CXX_COMPILER_FLAG(-Wnoexcept-type COMPILER_HAS_W_NOEXCEPT_TYPE)
166+
if (COMPILER_HAS_W_NOEXCEPT_TYPE)
167+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-noexcept-type")
168+
endif()
169+
164170
set(EXTRA_CXX_FLAGS ${EXTRA_CXX_FLAGS} -Werror)
165171

166172
if("${BUILD_TYPE_LOWER}" MATCHES "debug")

0 commit comments

Comments
 (0)