cmake BUGFIX findpcre2 for Debug config type

vcpkg for windows installs the pcre2 library with a slightly different
name and cmake did not find it when libyang is configured as Debug. The
translation ended up with a missing dll pcre2 library and therefore
non-working code.
diff --git a/CMakeModules/FindPCRE2.cmake b/CMakeModules/FindPCRE2.cmake
index 19af7b7..bb44f78 100644
--- a/CMakeModules/FindPCRE2.cmake
+++ b/CMakeModules/FindPCRE2.cmake
@@ -22,19 +22,24 @@
         ${CMAKE_INSTALL_PREFIX}/include)
 
     # Look for the library.
-    find_library(PCRE2_LIBRARY
-        NAMES
-        libpcre2.a
-        pcre2-8
-        PATHS
-        /usr/lib
-        /usr/lib64
-        /usr/local/lib
-        /usr/local/lib64
-        /opt/local/lib
-        /sw/lib
-        ${CMAKE_LIBRARY_PATH}
-        ${CMAKE_INSTALL_PREFIX}/lib)
+    if (WIN32 AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
+        # For the Debug build, the pcre2 library is called pcre2-8d. The Release build should be pcre2-8.
+        find_library(PCRE2_LIBRARY pcre2-8d)
+    else()
+        find_library(PCRE2_LIBRARY
+            NAMES
+            libpcre2.a
+            pcre2-8
+            PATHS
+            /usr/lib
+            /usr/lib64
+            /usr/local/lib
+            /usr/local/lib64
+            /opt/local/lib
+            /sw/lib
+            ${CMAKE_LIBRARY_PATH}
+            ${CMAKE_INSTALL_PREFIX}/lib)
+    endif()
 
     if(PCRE2_INCLUDE_DIR AND PCRE2_LIBRARY)
         # learn pcre2 version