--- CMakeLists.txt.orig	2009-10-31 18:22:43 UTC
+++ CMakeLists.txt
@@ -34,7 +34,7 @@ IF( WITH_ZLIB )
   FIND_PACKAGE( ZLIB REQUIRED )
 ENDIF( WITH_ZLIB )
 
-INCLUDE_DIRECTORIES( ${GLIB2_INCLUDE_DIR} ${LIBGSF_INCLUDE_DIR} ${ICONV_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
+INCLUDE_DIRECTORIES( ${GLIB2_INCLUDE_DIR} ${PC_LIBGSF_INCLUDE_DIRS} ${ICONV_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
 
 #
 # Iconv checks
@@ -59,7 +59,9 @@ IF( HAVE_SYS_ICONV_H )
   SET( ICONV_COMPILE_DEFINITIONS ${ICONV_COMPILE_DEFINITIONS} "-DHAVE_SYS_ICONV_H" )
 ENDIF( HAVE_SYS_ICONV_H )
 
-TRY_RUN( MODERN_ICONV_RUN MODERN_ICONV_COMPILE ${wvWare_BINARY_DIR}/CMakeTmp ${wvWare_SOURCE_DIR}/cmake/TestModernIconv.c COMPILE_DEFINITIONS ${ICONV_COMPILE_DEFINITIONS} )
+TRY_RUN( MODERN_ICONV_RUN MODERN_ICONV_COMPILE ${wvWare_BINARY_DIR}/CMakeTmp ${wvWare_SOURCE_DIR}/cmake/TestModernIconv.c
+    COMPILE_DEFINITIONS ${ICONV_COMPILE_DEFINITIONS}
+    CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${ICONV_INCLUDE_DIR} -DLINK_LIBRARIES=${ICONV_LIBRARIES} )
 
 IF( MODERN_ICONV_RUN GREATER 0 OR NOT MODERN_ICONV_COMPILE )
   MESSAGE( STATUS "wv2 depends on a modern iconv installation, supporting UNICODELITTLE and" )
@@ -143,8 +145,8 @@ IF( ZLIB_FOUND )
 ENDIF( ZLIB_FOUND )
 
 IF( LIBGSF_FOUND )
-  SET( _WV2_LDFLAGS ${_WV2_LDFLAGS} ${LIBGSF_LIBRARIES} )
-  SET( _WV2_CFLAGS ${_WV2_CFLAGS} ${LIBGSF_INCLUDE_DIR} )
+  SET( _WV2_LDFLAGS ${_WV2_LDFLAGS} ${PC_LIBGSF_LIBRARIES} )
+  SET( _WV2_CFLAGS ${_WV2_CFLAGS} ${PC_LIBGSF_INCLUDE_DIRS} )
 ENDIF( LIBGSF_FOUND )
 
 IF( ICONV_FOUND )
