Remove link to dl as it is in OpenBSD's libc
Have Cmake find and link to devel/pcre if installed, otherwise fall back to bundled pcre.
Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -59,8 +59,6 @@ set(SRC_COMMON
 	"${DIR_SRC}/vfs_pak.c"
 	"${DIR_SRC}/world.c"
 	"${DIR_SRC}/zone.c"
-	"${DIR_SRC}/pcre/get.c"
-	"${DIR_SRC}/pcre/pcre.c"
 	)
 
 # Check build target, and included sources
@@ -89,14 +87,31 @@ else()
 	)
 endif()
 
+######################################################################################################
 
+# Check for pcre, and include sources and libs, if found
+find_library(PCRE_LIBRARIES pcre)
+if(PCRE_LIBRARIES)
+	set(PCRE_FOUND 1)
+	find_path(PCRE_INCLUDE_DIR pcre.h)
+endif(PCRE_LIBRARIES)
+
+if(NOT PCRE_FOUND)
+	message(STATUS "PCRE library not found. Using bundled PCRE intead.")
+	list(APPEND SRC_COMMON
+	    "${DIR_SRC}/pcre/get.c"
+	    "${DIR_SRC}/pcre/pcre.c"
+	)
+else()
+	message(STATUS "Found PCRE: ${PCRE_LIBRARIES}")
+endif()
+
 ######################################################################################################
 
 # Set base compiler flags
 set(CFLAGS -Wall)
 set(LFLAGS)
 
-
 ######################################################################################################
 
 # Set target
@@ -111,14 +126,16 @@ set_target_properties(${PROJECT_NAME}
 
 # Set include directories
 target_include_directories(${PROJECT_NAME} PRIVATE ${CURL_INCLUDE_DIRS})
+target_include_directories(${PROJECT_NAME} PRIVATE ${PCRE_INCLUDE_DIR})
 
-
 ######################################################################################################
 
 # Check build target, and included sources and libs
 if(UNIX)
 	target_link_libraries(${PROJECT_NAME} m)
+if(NOT CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
 	target_link_libraries(${PROJECT_NAME} dl)
+endif()
 else()
 	target_link_libraries(${PROJECT_NAME} ws2_32)
 	target_link_libraries(${PROJECT_NAME} winmm)
@@ -147,6 +164,9 @@ if(CURL_FOUND)
 	target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES})
 endif()
 
+if(PCRE_FOUND)
+	target_link_libraries(${PROJECT_NAME} ${PCRE_LIBRARIES})
+endif()
 
 ######################################################################################################
 
