$OpenBSD: patch-CMakeLists_txt,v 1.20 2016/04/29 10:34:33 dcoppa Exp $
--- CMakeLists.txt.orig	Fri Apr 15 15:41:19 2016
+++ CMakeLists.txt	Wed Apr 27 10:55:08 2016
@@ -262,6 +262,15 @@ macro (CMAKE_BUILD_UTILITIES)
     CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestSharedForward "${kwsys_folder}")
   endif()
 
+  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")
+
   #---------------------------------------------------------------------
   # Setup third-party libraries.
   # Everything in the tree should be able to include files from the
@@ -425,15 +434,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)
