--- CMakeLists.txt.orig	2014-02-27 11:34:53 UTC
+++ CMakeLists.txt
@@ -65,19 +65,9 @@ ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
 
 INCLUDE(ExternalProject)
 
-ExternalProject_Add(
-    jansson
-    SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/jansson"
-    #GIT_REPOSITORY git://github.com/akheron/jansson.git
-    BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/jansson"
-    INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/jansson"
-    CMAKE_COMMAND cmake .
-    BUILD_COMMAND ""
-    INSTALL_COMMAND ""
-)
-
-INCLUDE_DIRECTORIES ("${CMAKE_CURRENT_SOURCE_DIR}/jansson")
-INCLUDE_DIRECTORIES ("${CMAKE_CURRENT_SOURCE_DIR}/jansson/include")
+FIND_PATH(JANSSON_INCLUDES jansson.h)
+INCLUDE_DIRECTORIES(${JANSSON_INCLUDES})
+FIND_LIBRARY(JANSSON_LIBRARIES jansson)
 
 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/platform.h.cmake" "${PROJECT_BINARY_DIR}/src/platform.h")
 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.cmake" "${PROJECT_BINARY_DIR}/src/version.h")
@@ -123,7 +113,7 @@ IF(UNIX)
         ENDIF(CAPN_ARCH_X86_64 AND OS_LINUX)
     ENDIF(LIB_SUFFIX)
     
-    SET(CAPN_INSTALL_PATH_LIB "${CAPN_INSTALL_PATH_LIB}/${CAPN_LIB_NAME}")
+    SET(CAPN_INSTALL_PATH_LIB "${CAPN_INSTALL_PATH_LIB}")
     SET(CAPN_PKGCONF_FILE_NAME "libcapn.pc")
     CONFIGURE_FILE("${CAPN_PKGCONF_FILE_NAME}.cmake" ${PROJECT_BINARY_DIR}/${CAPN_PKGCONF_FILE_NAME})
 
@@ -142,12 +132,9 @@ IF(UNIX)
 
 ENDIF(UNIX)
 
-FILE (GLOB JANSSON_SOURCE_FILES jansson/src/*.c)
-
 SET(CAPN_SOURCE_FILES
     src/apn.c
     src/apn_strings.c
-    ${JANSSON_SOURCE_FILES}
 )
 
 SET(CAPN_PUBLIC_HEADER_FILES
@@ -199,6 +186,7 @@ ENDIF(DEFINED WIN32)
 
 ADD_LIBRARY(${CAPN_LIB_NAME} SHARED ${CAPN_SOURCE_FILES})
 TARGET_LINK_LIBRARIES(${CAPN_LIB_NAME} ${OPENSSL_LIBRARIES})
+TARGET_LINK_LIBRARIES(${CAPN_LIB_NAME} ${JANSSON_LIBRARIES})
 
 IF(DEFINED WIN32)
 TARGET_LINK_LIBRARIES(${CAPN_LIB_NAME} Ws2_32.lib)
