diff --git a/CMakeLists.txt b/CMakeLists.txt index cf8afc62..85099008 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,22 +70,30 @@ if( MSVC ) set(OUT_OF_SOURCE 1) endif() + # link dependent libraries if ( NOT EXPAT_LIBRARY ) - # link dependent libraries if (OUT_OF_SOURCE) set(EXPAT_LIBRARY ../../../${E}/$(ConfigurationName)/expat) - set(ZLIB_LIBRARY ../../../${Z}/$(ConfigurationName)/zlib ) - set(EXPAT_INCLUDE_DIR ../${E}/lib ) - set(ZLIB_INCLUDE_DIR ../${Z} ) + set(EXPAT_INCLUDE_DIR ../${E}/lib) else() set(EXPAT_LIBRARY ../../${E}/$(ConfigurationName)/expat) - set(ZLIB_LIBRARY ../../${Z}/$(ConfigurationName)/zlib) - set(EXPAT_INCLUDE_DIR ../${E}/lib ) - set(ZLIB_INCLUDE_DIR ../${Z} ) + set(EXPAT_INCLUDE_DIR ../${E}/lib) endif() - include_directories( ${EXPAT_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} msvc64\\include src\\include) + include_directories( ${EXPAT_INCLUDE_DIR} msvc64\\include src\\include) endif() + FIND_PACKAGE(ZLIB QUIET) + if ( NOT ZLIB_FOUND ) + if (OUT_OF_SOURCE) + set(ZLIB_LIBRARY ../../../${Z}/$(ConfigurationName)/zlib ) + set(ZLIB_INCLUDE_DIR ../${Z}) + else() + set(ZLIB_LIBRARY ../../${Z}/$(ConfigurationName)/zlib) + set(ZLIB_INCLUDE_DIR ../${Z}) + endif() + endif() + include_directories(${ZLIB_INCLUDE_DIR}) + if ( EXIV2_ENABLE_SHARED ) add_library(${E} SHARED IMPORTED) add_library(${Z} SHARED IMPORTED) diff --git a/README-CMAKE b/README-CMAKE index 820b6c96..d7ef9bf0 100644 --- a/README-CMAKE +++ b/README-CMAKE @@ -214,6 +214,12 @@ Specify the location of the prebuilt libraries on the cmake command line: For example: cmake -G "NMake Makefiles" .. -DEXPAT_LIBRARY=%KDE4_INSTALL_DIR%/lib/libexpat.lib +Daniel has provided a patch (SVN:2893) which enables you to specify a ZLIB search path: +Example: + cmake.exe -G "Visual Studio 11 Win64" -DZLIB_ROOT=..\zlib-1.2.7-dev;..\zlib-1.2.7-dev\Release ... + +If ZLIB is not located on the path provided, the normal default (..\zlib-1.2.7) will be used. + ToDo: More information about parameters -DEXPAT_LIBRARTY -DZLIB_LIBRARY etc. 4 Building and Installing for other users (Xcode, Eclipse, Qt)