Merge pull request #23991 from buyuer:4.x

Eliminating compilation warnings when using lto in gcc12 and later versions
pull/24026/head
Alexander Smorkalov 2 years ago committed by GitHub
commit 0519e05432
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      cmake/OpenCVCompilerOptions.cmake

@ -261,8 +261,12 @@ if(CV_GCC OR CV_CLANG)
endif() endif()
if(ENABLE_LTO) if(ENABLE_LTO)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
add_extra_compiler_option(-flto=auto)
else()
add_extra_compiler_option(-flto) add_extra_compiler_option(-flto)
endif() endif()
endif()
if(ENABLE_THIN_LTO) if(ENABLE_THIN_LTO)
add_extra_compiler_option(-flto=thin) add_extra_compiler_option(-flto=thin)
endif() endif()

Loading…
Cancel
Save