From 38c62f646123949337767082eacbf19812e87ad3 Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Thu, 7 Dec 2017 10:28:58 +0300 Subject: [PATCH] Added option to disable gc-sections flag --- cmake/OpenCVCompilerOptions.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index 992ed72ec6..47dc7051ad 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -184,8 +184,8 @@ if(CMAKE_COMPILER_IS_GNUCXX) # Remove unreferenced functions: function level linking add_extra_compiler_option(-ffunction-sections) add_extra_compiler_option(-fdata-sections) - if(NOT APPLE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") + if(NOT APPLE AND NOT OPENCV_SKIP_GC_SECTIONS) + set(OPENCV_EXTRA_EXE_LINKER_FLAGS "${OPENCV_EXTRA_EXE_LINKER_FLAGS} -Wl,--gc-sections") endif() endif()