build CHANGE require libpcre2 version 10.30 or greater
Due to use of PCRE2_ENDANCHORED macro, we need the specific version of this
library.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c3d9160..c592d44 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -282,7 +282,7 @@
# find PCRE2 library
unset(PCRE2_LIBRARY CACHE)
-find_package(PCRE2 REQUIRED)
+find_package(PCRE2 10.30 REQUIRED)
include_directories(${PCRE2_INCLUDE_DIRS})
target_link_libraries(yang ${PCRE2_LIBRARIES})
diff --git a/CMakeModules/FindPCRE2.cmake b/CMakeModules/FindPCRE2.cmake
index c971775..8f60daa 100644
--- a/CMakeModules/FindPCRE2.cmake
+++ b/CMakeModules/FindPCRE2.cmake
@@ -11,9 +11,12 @@
# Look for the library.
FIND_LIBRARY(PCRE2_LIBRARY NAMES libpcre2.a pcre2-8)
+# Check required version
+execute_process(COMMAND pcre2-config --version OUTPUT_VARIABLE PCRE2_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+
# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE.
INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE2 DEFAULT_MSG PCRE2_LIBRARY PCRE2_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE2 REQUIRED_VARS PCRE2_LIBRARY PCRE2_INCLUDE_DIR VERSION_VAR PCRE2_VERSION)
# Copy the results to the output variables.
IF(PCRE2_FOUND)
diff --git a/README.md b/README.md
index 410632d..b674eca 100644
--- a/README.md
+++ b/README.md
@@ -39,14 +39,14 @@
* C compiler
* cmake >= 2.8.12
-* libpcre (devel package)
+* libpcre2 >= 10.30 (including devel package)
* note, that PCRE is supposed to be compiled with unicode support (configure's options
`--enable-utf` and `--enable-unicode-properties`)
#### Optional
* doxygen (for generating documentation)
-* cmocka >= 1.0.0 (for [tests](#Tests)
+* cmocka >= 1.0.0 (for [tests](#Tests))
* valgrind (for enhanced testing)
* gcov (for code coverage)
* lcov (for code coverage)
@@ -54,7 +54,7 @@
### Runtime Requirements
-* libpcre
+* libpcre2 >= 10.30
## Building