Skip to content

Commit 7a59b76

Browse files
author
Vaughn
committed
Change to matches for clang compat
1 parent b2f733b commit 7a59b76

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

modules/c++/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if (MSVC)
99
# > extremely noisy and low-value warnings. In general, the STL does not attempt to be `/Wall` clean.
1010
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # add_compile_options(/W4)
1111

12-
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
12+
elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
1313
# https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
1414
#add_compile_options(-Werror) # Make all warnings into errors
1515
add_compile_options(-Wall -Wextra -Wpedantic -pedantic-errors -Wunused)
@@ -19,8 +19,6 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
1919
add_compile_options(-Wsuggest-override)
2020
add_compile_options(-Woverloaded-virtual)
2121
#add_compile_options(-Warray-bounds)
22-
add_compile_options(-Wduplicated-branches -Wduplicated-cond)
23-
add_compile_options(-Wtrampolines)
2422
add_compile_options(-Wshadow)
2523
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast")
2624
#add_compile_options(-Wfloat-equal)
@@ -30,7 +28,12 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
3028
add_compile_options(-Wno-double-promotion) # implicit conversion of `float` to `double` is fine
3129

3230
add_compile_options(-Wno-array-bounds) # TODO: fix the code!
33-
add_compile_options(-Wno-maybe-uninitialized) # TODO: fix the code!
31+
32+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
33+
add_compile_options(-Wduplicated-branches -Wduplicated-cond)
34+
add_compile_options(-Wtrampolines)
35+
add_compile_options(-Wno-maybe-uninitialized) # TODO: fix the code!
36+
endif()
3437

3538
# Need a newer compiler than GCC 9
3639
#add_compile_options(-Wnrvo)

modules/c++/xml.lite/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
set(MODULE_NAME xml.lite)
22

33
if(ENABLE_XML)
4-
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
5-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-zero-as-null-pointer-constant")
6-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-suggest-override")
4+
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
5+
add_compile_options(-Wno-zero-as-null-pointer-constant -Wno-suggest-override)
76
endif()
87

98
if(CONAN_PACKAGE_NAME)

0 commit comments

Comments
 (0)