From: Maksim Shabunin Date: Tue, 31 Jan 2017 09:36:26 +0000 (+0300) Subject: Enable GNU STL debug mode for debug builds X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1227^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50d350bcd1b6b5c2af12dade2a7c2df426b5c621;p=platform%2Fupstream%2Fopencv.git Enable GNU STL debug mode for debug builds --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c79ad2b..91fad31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -295,6 +295,7 @@ OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors" OCV_OPTION(ANDROID_EXAMPLES_WITH_LIBS "Build binaries of Android examples with native libraries" OFF IF ANDROID ) OCV_OPTION(ENABLE_IMPL_COLLECTION "Collect implementation data on function call" OFF ) OCV_OPTION(ENABLE_INSTRUMENTATION "Instrument functions to collect calls trace and performance" OFF ) +OCV_OPTION(ENABLE_GNU_STL_DEBUG "Enable GNU STL Debug mode (defines _GLIBCXX_DEBUG)" OFF IF ((NOT CMAKE_VERSION VERSION_LESS "2.8.11") AND CMAKE_COMPILER_IS_GNUCXX) ) OCV_OPTION(GENERATE_ABI_DESCRIPTOR "Generate XML file for abi_compliance_checker tool" OFF IF UNIX) OCV_OPTION(DOWNLOAD_EXTERNAL_TEST_DATA "Download external test data (Python executable and OPENCV_TEST_DATA_PATH environment variable may be required)" OFF ) diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index 6e6fe16..ce2bc7e 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -858,10 +858,13 @@ macro(_ocv_create_module) if((NOT DEFINED OPENCV_MODULE_TYPE AND BUILD_SHARED_LIBS) OR (DEFINED OPENCV_MODULE_TYPE AND OPENCV_MODULE_TYPE STREQUAL SHARED)) - set_target_properties(${the_module} PROPERTIES COMPILE_DEFINITIONS CVAPI_EXPORTS) set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS) endif() + if (ENABLE_GNU_STL_DEBUG) + target_compile_definitions(${the_module} PUBLIC _GLIBCXX_DEBUG) + endif() + if(MSVC) if(CMAKE_CROSSCOMPILING) set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:secchk")