Skip to content

Commit 13cd883

Browse files
committed
cmake: warnings only for C++
1 parent 0bbd8fa commit 13cd883

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/cmake/modules/myci.cmake

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,10 @@ function(myci_declare_library name)
906906
)
907907
else()
908908
target_compile_options(${name} PRIVATE
909-
-Wall
910-
-Werror
909+
# Enable more warnings only for C++ files.
910+
# We don't care much about C files, as C code is only maintained by 3rd party.
911+
$<$<COMPILE_LANGUAGE:CXX>:-Wall>
912+
$<$<COMPILE_LANGUAGE:CXX>:-Werror>
911913
$<$<COMPILE_LANGUAGE:CXX>:-Wnon-virtual-dtor> # only for C++ files
912914
-fstrict-aliasing
913915
)
@@ -1188,8 +1190,10 @@ function(myci_declare_application name)
11881190
)
11891191
else()
11901192
target_compile_options(${name} PRIVATE
1191-
-Wall
1192-
-Werror
1193+
# Enable more warnings only for C++ files.
1194+
# We don't care much about C files, as C code is only maintained by 3rd party.
1195+
$<$<COMPILE_LANGUAGE:CXX>:-Wall>
1196+
$<$<COMPILE_LANGUAGE:CXX>:-Werror>
11931197
$<$<COMPILE_LANGUAGE:CXX>:-Wnon-virtual-dtor> # only for C++ files
11941198
-fstrict-aliasing
11951199
)

0 commit comments

Comments
 (0)