$OpenBSD: patch-CMakeLists_txt,v 1.19 2016/01/28 11:28:02 dcoppa Exp $
--- CMakeLists.txt.orig	Thu Nov 12 16:39:50 2015
+++ CMakeLists.txt	Mon Nov 23 16:20:59 2015
@@ -270,6 +270,15 @@ macro (CMAKE_BUILD_UTILITIES)
   # (a macro defined in this file)
   CMAKE_HANDLE_SYSTEM_LIBRARIES()
 
+  if($ENV{LOCALBASE})
+    set(OPENBSD_LOCALBASE $ENV{LOCALBASE})
+  else()
+    set(OPENBSD_LOCALBASE "/usr/local")
+  endif()
+
+  # to find expat and curl
+  link_directories("${OPENBSD_LOCALBASE}/lib")
+
   #---------------------------------------------------------------------
   # Build zlib library for Curl, CMake, and CTest.
   set(CMAKE_ZLIB_HEADER "cm_zlib.h")
@@ -404,15 +413,17 @@ macro (CMAKE_BUILD_UTILITIES)
   # Build jsoncpp library.
   if(CMAKE_USE_SYSTEM_JSONCPP)
     if(NOT CMAKE_VERSION VERSION_LESS 3.0)
-      include(${CMake_SOURCE_DIR}/Source/Modules/FindJsonCpp.cmake)
+      set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMake_SOURCE_DIR}/Source/Modules)
     else()
       message(FATAL_ERROR "CMAKE_USE_SYSTEM_JSONCPP requires CMake >= 3.0")
     endif()
+    find_package(JsonCpp)
     if(NOT JsonCpp_FOUND)
       message(FATAL_ERROR
         "CMAKE_USE_SYSTEM_JSONCPP is ON but a JsonCpp is not found!")
     endif()
-    set(CMAKE_JSONCPP_LIBRARIES JsonCpp::JsonCpp)
+    set(CMAKE_JSONCPP_INCLUDES ${JsonCpp_INCLUDE_DIRS})
+    set(CMAKE_JSONCPP_LIBRARIES ${JsonCpp_LIBRARIES})
   else()
     set(CMAKE_JSONCPP_LIBRARIES cmjsoncpp)
     add_subdirectory(Utilities/cmjsoncpp)
