Look for libjpeg in a more proper manner and don't just assume it's in a
standard path.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4314 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04c7697..112aa8d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -93,6 +93,9 @@
   set(USE_INCLUDED_ZLIB 1)
 endif()
 
+# Check for libjpeg
+find_package(JPEG REQUIRED)
+
 # Check for GNUTLS library
 find_package(GnuTLS)
 if(GNUTLS_FOUND)
diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt
index ca723fe..7679437 100644
--- a/common/rfb/CMakeLists.txt
+++ b/common/rfb/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories(${CMAKE_SOURCE_DIR}/common ${CMAKE_SOURCE_DIR}/win)
+include_directories(${CMAKE_SOURCE_DIR}/common ${CMAKE_SOURCE_DIR}/win ${JPEG_INCLUDE_DIR})
 
 set(RFB_SOURCES
   Blacklist.cxx
@@ -65,7 +65,7 @@
   encodings.cxx
   util.cxx)
 
-set(RFB_LIBRARIES jpeg os)
+set(RFB_LIBRARIES ${JPEG_LIBRARIES} os)
 
 if(GNUTLS_FOUND)
   set(RFB_SOURCES