From b39ee54103b29cd9e835acc65ca3b07ea1509469 Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Thu, 16 Dec 2021 11:40:42 +0300 Subject: [PATCH] Do not force -O2 flag in hardening-enabled builds --- cmake/OpenCVCompilerDefenses.cmake | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cmake/OpenCVCompilerDefenses.cmake b/cmake/OpenCVCompilerDefenses.cmake index 62029ea38b..9fffdb4d72 100644 --- a/cmake/OpenCVCompilerDefenses.cmake +++ b/cmake/OpenCVCompilerDefenses.cmake @@ -87,11 +87,3 @@ endif() set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OPENCV_LINKER_DEFENSES_FLAGS_COMMON}" ) set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OPENCV_LINKER_DEFENSES_FLAGS_COMMON}" ) set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OPENCV_LINKER_DEFENSES_FLAGS_COMMON}" ) - -if(CV_GCC OR CV_CLANG) - foreach(flags - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG - CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG) - string(REPLACE "-O3" "-O2" ${flags} "${${flags}}") - endforeach() -endif()