103
103
# 2023-01-15 Carlo added C99 as the minimum required
104
104
# 2023-08-06 PH added support for setting variable length lookbehind maximum
105
105
106
- # Increased minimum to 3.5 to workaround deprecated backward compatibility
107
- # since 3.27.
108
- cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
106
+ # Increased minimum to 3.15 to allow use of string(REPEAT).
107
+ cmake_minimum_required (VERSION 3.15 FATAL_ERROR)
109
108
project (PCRE2 C)
110
109
set (CMAKE_C_STANDARD 99)
111
110
set (CMAKE_C_STANDARD_REQUIRED TRUE )
@@ -239,7 +238,8 @@ OPTION(PCRE2_BUILD_PCRE2_32 "Build 32 bit PCRE2 library" OFF)
239
238
240
239
OPTION (PCRE2_STATIC_PIC "Build the static library with the option position independent code enabled." OFF )
241
240
242
- OPTION (PCRE2_DEBUG "Include debugging code" OFF )
241
+ set (PCRE2_DEBUG "IfDebugBuild" CACHE STRING "Include debugging code" )
242
+ set_property (CACHE PCRE2_DEBUG PROPERTY STRINGS "IfDebugBuild" "ON" "OFF" )
243
243
244
244
OPTION (PCRE2_DISABLE_PERCENT_ZT "Disable the use of %zu and %td (rarely needed)" OFF )
245
245
@@ -439,7 +439,7 @@ IF(PCRE2_SUPPORT_JIT_SEALLOC)
439
439
UNSET (CMAKE_REQUIRED_DEFINITIONS)
440
440
IF (${REQUIRED} )
441
441
IF (${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
442
- ADD_DEFINITIONS (-D_GNU_SOURCE )
442
+ ADD_COMPILE_DEFINITIONS (_GNU_SOURCE )
443
443
SET (SLJIT_PROT_EXECUTABLE_ALLOCATOR 1)
444
444
ELSE (${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
445
445
MESSAGE (FATAL_ERROR "Your configuration is not supported" )
@@ -687,10 +687,16 @@ ENDIF(MSVC AND PCRE2_STATIC_RUNTIME)
687
687
688
688
# Build setup
689
689
690
- ADD_DEFINITIONS (-DHAVE_CONFIG_H)
690
+ ADD_COMPILE_DEFINITIONS (HAVE_CONFIG_H)
691
+
692
+ if (PCRE2_DEBUG STREQUAL "IfDebugBuild" )
693
+ ADD_COMPILE_DEFINITIONS ("$<$<CONFIG:Debug>:PCRE2_DEBUG>" )
694
+ elseif (PCRE2_DEBUG)
695
+ ADD_COMPILE_DEFINITIONS ("PCRE2_DEBUG" )
696
+ endif ()
691
697
692
698
IF (MSVC )
693
- ADD_DEFINITIONS (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS )
699
+ ADD_COMPILE_DEFINITIONS (_CRT_SECURE_NO_DEPRECATE _CRT_SECURE_NO_WARNINGS )
694
700
ENDIF (MSVC )
695
701
696
702
SET (CMAKE_INCLUDE_CURRENT_DIR 1)
@@ -1029,6 +1035,8 @@ MESSAGE(\" \")
1029
1035
"#! /bin/sh
1030
1036
# This is a generated file.
1031
1037
srcdir=${PROJECT_SOURCE_DIR}
1038
+ pcre2test=${PROJECT_BINARY_DIR} /pcre2test
1039
+ test -z \" $CMAKE_CONFIG_TYPE\" || pcre2test=${PROJECT_BINARY_DIR} /$CMAKE_CONFIG_TYPE/pcre2test
1032
1040
. ${PROJECT_SOURCE_DIR} /RunTest
1033
1041
if test \" $?\" != \" 0\" ; then exit 1; fi
1034
1042
# End
@@ -1043,6 +1051,10 @@ if test \"$?\" != \"0\"; then exit 1; fi
1043
1051
"#! /bin/sh
1044
1052
# This is a generated file.
1045
1053
srcdir=${PROJECT_SOURCE_DIR}
1054
+ pcre2grep=${PROJECT_BINARY_DIR} /pcre2grep
1055
+ test -z \" $CMAKE_CONFIG_TYPE\" || pcre2grep=${PROJECT_BINARY_DIR} /$CMAKE_CONFIG_TYPE/pcre2grep
1056
+ pcre2test=${PROJECT_BINARY_DIR} /pcre2test
1057
+ test -z \" $CMAKE_CONFIG_TYPE\" || pcre2test=${PROJECT_BINARY_DIR} /$CMAKE_CONFIG_TYPE/pcre2test
1046
1058
. ${PROJECT_SOURCE_DIR} /RunGrepTest
1047
1059
if test \" $?\" != \" 0\" ; then exit 1; fi
1048
1060
# End
@@ -1147,81 +1159,100 @@ IF(PCRE2_HEAP_MATCH_RECURSE)
1147
1159
ENDIF (PCRE2_HEAP_MATCH_RECURSE)
1148
1160
1149
1161
IF (PCRE2_SHOW_REPORT)
1150
- STRING (TOUPPER "${CMAKE_BUILD_TYPE} " buildtype)
1151
- IF (CMAKE_C_FLAGS)
1152
- SET (cfsp " " )
1153
- ENDIF (CMAKE_C_FLAGS)
1154
1162
MESSAGE (STATUS "" )
1155
1163
MESSAGE (STATUS "" )
1156
1164
MESSAGE (STATUS "PCRE2-${PCRE2_MAJOR} .${PCRE2_MINOR} configuration summary:" )
1157
1165
MESSAGE (STATUS "" )
1158
- MESSAGE (STATUS " Install prefix .................. : ${CMAKE_INSTALL_PREFIX} " )
1159
- MESSAGE (STATUS " C compiler ...................... : ${CMAKE_C_COMPILER} " )
1160
- MESSAGE (STATUS " C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp} ${CMAKE_C_FLAGS_${buildtype} }" )
1166
+ MESSAGE (STATUS " Install prefix .................... : ${CMAKE_INSTALL_PREFIX} " )
1167
+ MESSAGE (STATUS " C compiler ........................ : ${CMAKE_C_COMPILER} " )
1168
+ if (CMAKE_CONFIGURATION_TYPES )
1169
+ FOREACH (config IN LISTS CMAKE_CONFIGURATION_TYPES )
1170
+ STRING (TOUPPER "${config} " buildtype)
1171
+ STRING (LENGTH " (${config} )" buildtypelen)
1172
+ MATH (EXPR dotslen "18 - ${buildtypelen} " )
1173
+ STRING (REPEAT "." ${dotslen} dots)
1174
+ IF (CMAKE_C_FLAGS)
1175
+ SET (cfsp " " )
1176
+ ENDIF ()
1177
+ MESSAGE (STATUS " C compiler flags (${config} ) ${dots} : ${CMAKE_C_FLAGS}${cfsp} ${CMAKE_C_FLAGS_${buildtype} }" )
1178
+ ENDFOREACH ()
1179
+ ELSE ()
1180
+ STRING (TOUPPER "${CMAKE_BUILD_TYPE} " buildtype)
1181
+ IF (CMAKE_C_FLAGS)
1182
+ SET (cfsp " " )
1183
+ ENDIF ()
1184
+ MESSAGE (STATUS " C compiler flags .................. : ${CMAKE_C_FLAGS}${cfsp} ${CMAKE_C_FLAGS_${buildtype} }" )
1185
+ ENDIF ()
1186
+
1161
1187
MESSAGE (STATUS "" )
1162
- MESSAGE (STATUS " Build 8 bit PCRE2 library ....... : ${PCRE2_BUILD_PCRE2_8} " )
1163
- MESSAGE (STATUS " Build 16 bit PCRE2 library ...... : ${PCRE2_BUILD_PCRE2_16} " )
1164
- MESSAGE (STATUS " Build 32 bit PCRE2 library ...... : ${PCRE2_BUILD_PCRE2_32} " )
1165
- MESSAGE (STATUS " Include debugging code ...........: ${PCRE2_DEBUG} " )
1166
- MESSAGE (STATUS " Enable JIT compiling support .... : ${PCRE2_SUPPORT_JIT} " )
1167
- MESSAGE (STATUS " Use SELinux allocator in JIT .... : ${PCRE2_SUPPORT_JIT_SEALLOC} " )
1168
- MESSAGE (STATUS " Enable Unicode support .......... : ${PCRE2_SUPPORT_UNICODE} " )
1169
- MESSAGE (STATUS " Newline char/sequence ........... : ${PCRE2_NEWLINE} " )
1170
- MESSAGE (STATUS " \\ R matches only ANYCRLF ......... : ${PCRE2_SUPPORT_BSR_ANYCRLF} " )
1171
- MESSAGE (STATUS " \\ C is disabled .................. : ${PCRE2_NEVER_BACKSLASH_C} " )
1172
- MESSAGE (STATUS " EBCDIC coding ................... : ${PCRE2_EBCDIC} " )
1173
- MESSAGE (STATUS " EBCDIC coding with NL=0x25 ...... : ${PCRE2_EBCDIC_NL25} " )
1174
- MESSAGE (STATUS " Rebuild char tables ............. : ${PCRE2_REBUILD_CHARTABLES} " )
1175
- MESSAGE (STATUS " Internal link size .............. : ${PCRE2_LINK_SIZE} " )
1176
- MESSAGE (STATUS " Maximum variable lookbehind ..... : ${PCRE2_MAX_VARLOOKBEHIND} " )
1177
- MESSAGE (STATUS " Parentheses nest limit .......... : ${PCRE2_PARENS_NEST_LIMIT} " )
1178
- MESSAGE (STATUS " Heap limit ...................... : ${PCRE2_HEAP_LIMIT} " )
1179
- MESSAGE (STATUS " Match limit ..................... : ${PCRE2_MATCH_LIMIT} " )
1180
- MESSAGE (STATUS " Match depth limit ............... : ${PCRE2_MATCH_LIMIT_DEPTH} " )
1181
- MESSAGE (STATUS " Build shared libs ............... : ${BUILD_SHARED_LIBS} " )
1182
- MESSAGE (STATUS " Build static libs ............... : ${BUILD_STATIC_LIBS} " )
1183
- MESSAGE (STATUS " with PIC enabled ............. : ${PCRE2_STATIC_PIC} " )
1184
- MESSAGE (STATUS " Build pcre2grep ................. : ${PCRE2_BUILD_PCRE2GREP} " )
1185
- MESSAGE (STATUS " Enable JIT in pcre2grep ......... : ${PCRE2GREP_SUPPORT_JIT} " )
1186
- MESSAGE (STATUS " Enable callouts in pcre2grep .... : ${PCRE2GREP_SUPPORT_CALLOUT} " )
1187
- MESSAGE (STATUS " Enable callout fork in pcre2grep. : ${PCRE2GREP_SUPPORT_CALLOUT_FORK} " )
1188
- MESSAGE (STATUS " Buffer size for pcre2grep ....... : ${PCRE2GREP_BUFSIZE} " )
1189
- MESSAGE (STATUS " Build tests (implies pcre2test .. : ${PCRE2_BUILD_TESTS} " )
1188
+ IF (CMAKE_CONFIGURATION_TYPES )
1189
+ MESSAGE (STATUS " Build configurations .............. : ${CMAKE_CONFIGURATION_TYPES} " )
1190
+ ELSE ()
1191
+ MESSAGE (STATUS " Build type ........................ : ${CMAKE_BUILD_TYPE} " )
1192
+ ENDIF ()
1193
+ MESSAGE (STATUS " Build 8 bit PCRE2 library ......... : ${PCRE2_BUILD_PCRE2_8} " )
1194
+ MESSAGE (STATUS " Build 16 bit PCRE2 library ........ : ${PCRE2_BUILD_PCRE2_16} " )
1195
+ MESSAGE (STATUS " Build 32 bit PCRE2 library ........ : ${PCRE2_BUILD_PCRE2_32} " )
1196
+ MESSAGE (STATUS " Include debugging code ............ : ${PCRE2_DEBUG} " )
1197
+ MESSAGE (STATUS " Enable JIT compiling support ...... : ${PCRE2_SUPPORT_JIT} " )
1198
+ MESSAGE (STATUS " Use SELinux allocator in JIT ...... : ${PCRE2_SUPPORT_JIT_SEALLOC} " )
1199
+ MESSAGE (STATUS " Enable Unicode support ............ : ${PCRE2_SUPPORT_UNICODE} " )
1200
+ MESSAGE (STATUS " Newline char/sequence ............. : ${PCRE2_NEWLINE} " )
1201
+ MESSAGE (STATUS " \\ R matches only ANYCRLF ........... : ${PCRE2_SUPPORT_BSR_ANYCRLF} " )
1202
+ MESSAGE (STATUS " \\ C is disabled .................... : ${PCRE2_NEVER_BACKSLASH_C} " )
1203
+ MESSAGE (STATUS " EBCDIC coding ..................... : ${PCRE2_EBCDIC} " )
1204
+ MESSAGE (STATUS " EBCDIC coding with NL=0x25 ........ : ${PCRE2_EBCDIC_NL25} " )
1205
+ MESSAGE (STATUS " Rebuild char tables ............... : ${PCRE2_REBUILD_CHARTABLES} " )
1206
+ MESSAGE (STATUS " Internal link size ................ : ${PCRE2_LINK_SIZE} " )
1207
+ MESSAGE (STATUS " Maximum variable lookbehind ....... : ${PCRE2_MAX_VARLOOKBEHIND} " )
1208
+ MESSAGE (STATUS " Parentheses nest limit ............ : ${PCRE2_PARENS_NEST_LIMIT} " )
1209
+ MESSAGE (STATUS " Heap limit ........................ : ${PCRE2_HEAP_LIMIT} " )
1210
+ MESSAGE (STATUS " Match limit ....................... : ${PCRE2_MATCH_LIMIT} " )
1211
+ MESSAGE (STATUS " Match depth limit ................. : ${PCRE2_MATCH_LIMIT_DEPTH} " )
1212
+ MESSAGE (STATUS " Build shared libs ................. : ${BUILD_SHARED_LIBS} " )
1213
+ MESSAGE (STATUS " Build static libs ................. : ${BUILD_STATIC_LIBS} " )
1214
+ MESSAGE (STATUS " with PIC enabled ............... : ${PCRE2_STATIC_PIC} " )
1215
+ MESSAGE (STATUS " Build pcre2grep ................... : ${PCRE2_BUILD_PCRE2GREP} " )
1216
+ MESSAGE (STATUS " Enable JIT in pcre2grep ........... : ${PCRE2GREP_SUPPORT_JIT} " )
1217
+ MESSAGE (STATUS " Enable callouts in pcre2grep ...... : ${PCRE2GREP_SUPPORT_CALLOUT} " )
1218
+ MESSAGE (STATUS " Enable callout fork in pcre2grep .. : ${PCRE2GREP_SUPPORT_CALLOUT_FORK} " )
1219
+ MESSAGE (STATUS " Buffer size for pcre2grep ......... : ${PCRE2GREP_BUFSIZE} " )
1220
+ MESSAGE (STATUS " Build tests (implies pcre2test .... : ${PCRE2_BUILD_TESTS} " )
1190
1221
MESSAGE (STATUS " and pcre2grep)" )
1191
1222
IF (ZLIB_FOUND)
1192
- MESSAGE (STATUS " Link pcre2grep with libz ........ : ${PCRE2_SUPPORT_LIBZ} " )
1223
+ MESSAGE (STATUS " Link pcre2grep with libz .......... : ${PCRE2_SUPPORT_LIBZ} " )
1193
1224
ELSE (ZLIB_FOUND)
1194
- MESSAGE (STATUS " Link pcre2grep with libz ........ : Library not found" )
1225
+ MESSAGE (STATUS " Link pcre2grep with libz .......... : Library not found" )
1195
1226
ENDIF (ZLIB_FOUND)
1196
1227
IF (BZIP2_FOUND)
1197
- MESSAGE (STATUS " Link pcre2grep with libbz2 ...... : ${PCRE2_SUPPORT_LIBBZ2} " )
1228
+ MESSAGE (STATUS " Link pcre2grep with libbz2 ........ : ${PCRE2_SUPPORT_LIBBZ2} " )
1198
1229
ELSE (BZIP2_FOUND)
1199
- MESSAGE (STATUS " Link pcre2grep with libbz2 ...... : Library not found" )
1230
+ MESSAGE (STATUS " Link pcre2grep with libbz2 ........ : Library not found" )
1200
1231
ENDIF (BZIP2_FOUND)
1201
1232
IF (EDITLINE_FOUND)
1202
- MESSAGE (STATUS " Link pcre2test with libeditline . : ${PCRE2_SUPPORT_LIBEDIT} " )
1233
+ MESSAGE (STATUS " Link pcre2test with libeditline ... : ${PCRE2_SUPPORT_LIBEDIT} " )
1203
1234
ELSE (EDITLINE_FOUND)
1204
- MESSAGE (STATUS " Link pcre2test with libeditline . : Library not found" )
1235
+ MESSAGE (STATUS " Link pcre2test with libeditline ... : Library not found" )
1205
1236
ENDIF (EDITLINE_FOUND)
1206
1237
IF (READLINE_FOUND)
1207
- MESSAGE (STATUS " Link pcre2test with libreadline . : ${PCRE2_SUPPORT_LIBREADLINE} " )
1238
+ MESSAGE (STATUS " Link pcre2test with libreadline ... : ${PCRE2_SUPPORT_LIBREADLINE} " )
1208
1239
ELSE (READLINE_FOUND)
1209
- MESSAGE (STATUS " Link pcre2test with libreadline . : Library not found" )
1240
+ MESSAGE (STATUS " Link pcre2test with libreadline ... : Library not found" )
1210
1241
ENDIF (READLINE_FOUND)
1211
- MESSAGE (STATUS " Support Valgrind .................: ${PCRE2_SUPPORT_VALGRIND} " )
1242
+ MESSAGE (STATUS " Support Valgrind .................. : ${PCRE2_SUPPORT_VALGRIND} " )
1212
1243
IF (PCRE2_DISABLE_PERCENT_ZT)
1213
- MESSAGE (STATUS " Use %zu and %td ..................: OFF" )
1244
+ MESSAGE (STATUS " Use %zu and %td ................... : OFF" )
1214
1245
ELSE (PCRE2_DISABLE_PERCENT_ZT)
1215
- MESSAGE (STATUS " Use %zu and %td ..................: AUTO" )
1246
+ MESSAGE (STATUS " Use %zu and %td ................... : AUTO" )
1216
1247
ENDIF (PCRE2_DISABLE_PERCENT_ZT)
1217
1248
1218
1249
IF (MINGW AND BUILD_SHARED_LIBS )
1219
- MESSAGE (STATUS " Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX} " )
1220
- MESSAGE (STATUS " Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX} " )
1250
+ MESSAGE (STATUS " Non-standard dll names (prefix) ... : ${NON_STANDARD_LIB_PREFIX} " )
1251
+ MESSAGE (STATUS " Non-standard dll names (suffix) ... : ${NON_STANDARD_LIB_SUFFIX} " )
1221
1252
ENDIF (MINGW AND BUILD_SHARED_LIBS )
1222
1253
1223
1254
IF (MSVC )
1224
- MESSAGE (STATUS " Install MSVC .pdb files ..........: ${INSTALL_MSVC_PDB} " )
1255
+ MESSAGE (STATUS " Install MSVC .pdb files ........... : ${INSTALL_MSVC_PDB} " )
1225
1256
ENDIF (MSVC )
1226
1257
1227
1258
MESSAGE (STATUS "" )
0 commit comments