diff --git a/CMakeLists.txt b/CMakeLists.txt index ec8f70674..bcec3ba90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,7 +239,8 @@ OPTION(PCRE2_BUILD_PCRE2_32 "Build 32 bit PCRE2 library" OFF) OPTION(PCRE2_STATIC_PIC "Build the static library with the option position independent code enabled." OFF) -OPTION(PCRE2_DEBUG "Include debugging code" OFF) +set(PCRE2_DEBUG "IfDebugBuild" CACHE STRING "Include debugging code") +set_property(CACHE PCRE2_DEBUG PROPERTY STRINGS "IfDebugBuild" "ON" "OFF") OPTION(PCRE2_DISABLE_PERCENT_ZT "Disable the use of %zu and %td (rarely needed)" OFF) @@ -689,6 +690,12 @@ ENDIF(MSVC AND PCRE2_STATIC_RUNTIME) ADD_DEFINITIONS(-DHAVE_CONFIG_H) +if(PCRE2_DEBUG STREQUAL "IfDebugBuild") + ADD_COMPILE_DEFINITIONS("$<$:PCRE2_DEBUG>") +elseif(PCRE2_DEBUG) + ADD_COMPILE_DEFINITIONS("PCRE2_DEBUG") +endif() + IF(MSVC) ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS) ENDIF(MSVC) diff --git a/config-cmake.h.in b/config-cmake.h.in index bc413af6b..0440274d5 100644 --- a/config-cmake.h.in +++ b/config-cmake.h.in @@ -20,7 +20,6 @@ #cmakedefine SUPPORT_PCRE2_8 1 #cmakedefine SUPPORT_PCRE2_16 1 #cmakedefine SUPPORT_PCRE2_32 1 -#cmakedefine PCRE2_DEBUG 1 #cmakedefine DISABLE_PERCENT_ZT 1 #cmakedefine SUPPORT_LIBBZ2 1