Increase template-depth for Clang only when needed

Clang 7 increased the default template-depth to 1024.
This commit is contained in:
Øystein Myrmo 2022-03-22 14:24:01 +01:00 committed by Davis E. King
parent 4ebf3ef088
commit 04371157f7

View File

@ -131,8 +131,9 @@ if (CMAKE_COMPILER_IS_GNUCXX)
list(APPEND active_compile_opts "-Wreturn-type")
endif()
if ("Clang" MATCHES ${CMAKE_CXX_COMPILER_ID})
# Increase clang's default tempalte recurision depth so the dnn examples don't error out.
if ("Clang" MATCHES ${CMAKE_CXX_COMPILER_ID} AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)
# Clang 6 had a default template recursion depth of 256. This was changed to 1024 in Clang 7.
# It must be increased on Clang 6 and below to ensure that the dnn examples don't error out.
list(APPEND active_compile_opts "-ftemplate-depth=500")
endif()