Browse Source

Enable -Wundefined-func-template when building CMake's C++ code

Extend commit d06a9bdf3a (Enable some compiler warnings when building
CMake, 2012-09-23, v2.8.11~420^2) to add `-Wundefined-func-template`.

Suggested-by: Matthew Woehlke <[email protected]>
Brad King 2 months ago
parent
commit
78c0935c9b
1 changed files with 6 additions and 0 deletions
  1. 6 0
      CMakeLists.txt

+ 6 - 0
CMakeLists.txt

@@ -500,6 +500,12 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
       set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W
                          -Wshadow -Wpointer-arith -Wformat-security -Wundef
       )
+      if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND
+          NOT (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11))
+        list(APPEND CXX_FLAGS_LIST
+          -Wundefined-func-template
+        )
+      endif()
 
       foreach(FLAG_LANG IN ITEMS C CXX)
         foreach(FLAG IN LISTS ${FLAG_LANG}_FLAGS_LIST)