Skip to content

Commit 50d350b

Browse files
committed
Enable GNU STL debug mode for debug builds
1 parent 0aab7c6 commit 50d350b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors"
295295
OCV_OPTION(ANDROID_EXAMPLES_WITH_LIBS "Build binaries of Android examples with native libraries" OFF IF ANDROID )
296296
OCV_OPTION(ENABLE_IMPL_COLLECTION "Collect implementation data on function call" OFF )
297297
OCV_OPTION(ENABLE_INSTRUMENTATION "Instrument functions to collect calls trace and performance" OFF )
298+
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) )
298299
OCV_OPTION(GENERATE_ABI_DESCRIPTOR "Generate XML file for abi_compliance_checker tool" OFF IF UNIX)
299300

300301
OCV_OPTION(DOWNLOAD_EXTERNAL_TEST_DATA "Download external test data (Python executable and OPENCV_TEST_DATA_PATH environment variable may be required)" OFF )

cmake/OpenCVModule.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,10 +858,13 @@ macro(_ocv_create_module)
858858

859859
if((NOT DEFINED OPENCV_MODULE_TYPE AND BUILD_SHARED_LIBS)
860860
OR (DEFINED OPENCV_MODULE_TYPE AND OPENCV_MODULE_TYPE STREQUAL SHARED))
861-
set_target_properties(${the_module} PROPERTIES COMPILE_DEFINITIONS CVAPI_EXPORTS)
862861
set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS)
863862
endif()
864863

864+
if (ENABLE_GNU_STL_DEBUG)
865+
target_compile_definitions(${the_module} PUBLIC _GLIBCXX_DEBUG)
866+
endif()
867+
865868
if(MSVC)
866869
if(CMAKE_CROSSCOMPILING)
867870
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:secchk")

0 commit comments

Comments
 (0)