summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorLaurent Rineau <Laurent.Rineau@cgal.org>2020-03-12 20:14:57 (GMT)
committerGitHub <noreply@github.com>2020-03-12 20:14:57 (GMT)
commit01edb490daa2942227992d8a60bd3673551995bf (patch)
tree480aac22ab3a2667657b2cd2391f59fde61c5cbb /cmake
parentf24a0791257f7a5236ca24b5fbbfbe1bb9638486 (diff)
downloadDoxygen-01edb490daa2942227992d8a60bd3673551995bf.zip
Doxygen-01edb490daa2942227992d8a60bd3673551995bf.tar.gz
Doxygen-01edb490daa2942227992d8a60bd3673551995bf.tar.bz2
Fix C compiler warnings about C++ flags (#7636)
* Fix C compiler warnings about C++ flags ``` cc1: warning: command line option ‘-Wnon-virtual-dtor’ is valid for C++/ObjC++ but not for C cc1: warning: command line option ‘-Woverloaded-virtual’ is valid for C++/ObjC++ but not for C ``` ... using the generator expression `$<COMPILE_LANGUAGE:CXX>`. * COMPILE_LANGUAGE is new in CMake 3.3 See https://cmake.org/cmake/help/v3.3/release/3.3.html * CMake 3.3 is required
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CompilerWarnings.cmake22
1 files changed, 12 insertions, 10 deletions
diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake
index 4c422b6..b7c6a54 100644
--- a/cmake/CompilerWarnings.cmake
+++ b/cmake/CompilerWarnings.cmake
@@ -41,14 +41,15 @@ function(set_project_warnings project_name)
-Wextra # reasonable and standard
-Wshadow # warn the user if a variable declaration shadows one from a
# parent context
- -Wnon-virtual-dtor # warn the user if a class with virtual functions has a
- # non-virtual destructor. This helps catch hard to
- # track down memory errors
+ $<$<COMPILE_LANGUAGE:CXX>:-Wnon-virtual-dtor>
+ # warn the user if a class with virtual functions has a
+ # non-virtual destructor. This helps catch hard to
+ # track down memory errors
# -Wold-style-cast # warn for c-style casts
-Wcast-align # warn for potential performance problem casts
-Wunused # warn on anything being unused
- -Woverloaded-virtual # warn if you overload (not override) a virtual
- # function
+ $<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual>
+ # warn if you overload (not override) a virtual function
-Wpedantic # warn if non-standard C++ is used
-Wconversion # warn on type conversions that may lose data
-Wnull-dereference # warn if a null dereference is detected
@@ -72,14 +73,15 @@ function(set_project_warnings project_name)
-Wextra # reasonable and standard
#-Wshadow # warn the user if a variable declaration shadows one from a
# # parent context
- -Wnon-virtual-dtor # warn the user if a class with virtual functions has a
- # non-virtual destructor. This helps catch hard to
- # track down memory errors
+ $<$<COMPILE_LANGUAGE:CXX>:-Wnon-virtual-dtor>
+ # warn the user if a class with virtual functions has a
+ # non-virtual destructor. This helps catch hard to
+ # track down memory errors
# -Wold-style-cast # warn for c-style casts
-Wcast-align # warn for potential performance problem casts
-Wunused # warn on anything being unused
- -Woverloaded-virtual # warn if you overload (not override) a virtual
- # function
+ $<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual>
+ # warn if you overload (not override) a virtual function
-Wpedantic # warn if non-standard C++ is used
#-Wconversion # warn on type conversions that may lose data
#-Wnull-dereference # warn if a null dereference is detected