diff --git a/CMakeLists.txt b/CMakeLists.txt index 96671711..ac725730 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ # CMake build system for exiv2 library and executables +# Copyright 2015- Daniel Kaneider # Copyright 2012- Robin Mills # Copyright 2010-2012 Gilles Caulier # Copyright 2008 Patrick Spendrin @@ -55,7 +56,12 @@ OPTION( EXIV2_ENABLE_VIDEO "Build video support into library" OPTION( EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF ) OPTION( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo" ON ) OPTION( EXIV2_ENABLE_SSH "USE Libssh for SshIo" ON ) -OPTION( EXIV2_ENABLE_WIN_UNICODE "Use Unicode paths (wstring) on Windows" OFF ) +IF (WIN32) + OPTION( EXIV2_ENABLE_WIN_UNICODE "Use Unicode paths (wstring) on Windows" OFF ) +ENDIF() + +# set include path for FindXXX.cmake files +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/config/") IF( MINGW OR UNIX ) IF ( CMAKE_CXX_COMPILER STREQUAL "g++" OR CMAKE_C_COMPILER STREQUAL "gcc" ) @@ -70,13 +76,13 @@ IF( MINGW OR UNIX ) ENDIF() ENDIF( MINGW OR UNIX ) -# Force unicode support on windows -IF (WIN32) - IF( EXIV2_ENABLE_WIN_UNICODE ) - ADD_DEFINITIONS( -DEXV_UNICODE_PATH ) - ENDIF() +IF( EXIV2_ENABLE_COMMERCIAL ) + SET (EXIV2_ENABLE_LENSDATA OFF) + SET (EXIV2_ENABLE_NLS OFF) ENDIF() + +# binary as first, since it workarounds old VS solution compatibility problems INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src/ ${CMAKE_SOURCE_DIR}/include/ ${CMAKE_SOURCE_DIR}/include/exiv2/) if( MSVC ) @@ -95,10 +101,6 @@ if( MSVC ) set(C curl-7.39.0) set(C libssh-0.5.5) - if( NOT IS_DIRECTORY ./../${E} ) - set(OUT_OF_SOURCE 1) - endif() - # link dependent libraries FIND_PACKAGE(EXPAT QUIET) if ( NOT EXPAT_LIBRARY ) @@ -114,13 +116,6 @@ if( MSVC ) include_directories( ${CURL_INCLUDE_DIR}) endif() - # FIND_PACKAGE(SSH) - if ( NOT SSH_FOUND ) - set(SSH_LIBRARY ${CMAKE_SOURCE_DIR}/../${C}/$(ConfigurationName)/ssh) - set(SSH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../${C}) - include_directories( ${SSH_INCLUDE_DIR}) - endif() - FIND_PACKAGE(ZLIB QUIET) if ( NOT ZLIB_FOUND ) set(ZLIB_LIBRARY ${CMAKE_SOURCE_DIR}/../${Z}/$(ConfigurationName)/zlib) diff --git a/README-CMAKE b/README-CMAKE index 70647c0c..176db51d 100644 --- a/README-CMAKE +++ b/README-CMAKE @@ -1,8 +1,8 @@ ------------------------------------------------------------------------------- NOTE: -* CMake scripts are "work in progress". - Use them only if you're prepared to fix them. +* CMake scripts are "mostly" functional. + Use them only if you're know how to use CMake (i.e. be prepared to fix them). See TODO-CMAKE for known pending tasks. * The existing automake (./configure), msvc2003 and msvc2005 build files will continue diff --git a/config/CMakeChecks.txt b/config/CMakeChecks.txt index 152d2a23..2528eace 100644 --- a/config/CMakeChecks.txt +++ b/config/CMakeChecks.txt @@ -1,4 +1,5 @@ # CMake build system for exiv2 library and executables +# Copyright 2015 by Daniel Kaneider # Copyright 2008 by Patrick Spendrin # Copyright 2010 by Gilles Caulier # @@ -30,7 +31,6 @@ # # ConfigureChecks for exiv2 -SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/config ) INCLUDE( CheckIncludeFile ) INCLUDE( CheckFunctionExists ) INCLUDE( CheckSymbolExists ) @@ -64,29 +64,15 @@ ENDIF( EXIV2_ENABLE_VIDEO ) IF( EXIV2_ENABLE_WEBREADY ) SET( ENABLE_WEBREADY 1 ) IF( EXIV2_ENABLE_CURL ) - FIND_PACKAGE( CURL ) + FIND_PACKAGE( CURL REQUIRED) INCLUDE_DIRECTORIES( ${CURL_INCLUDE_DIR} ) - # FindCURL.cmake doesn't check for REQUIRED flags - so we need to check ourselves - IF( MINGW OR UNIX ) - IF (NOT CURL_FOUND) - MESSAGE(FATAL_ERROR "missing library curl required for HttpIo") - ELSE (NOT CURL_FOUND) - SET ( USE_CURL 1 ) - ENDIF( NOT CURL_FOUND ) - ENDIF( MINGW OR UNIX ) - ENDIF( EXIV2_ENABLE_CURL ) + SET ( USE_CURL 1 ) + ENDIF() IF( EXIV2_ENABLE_SSH ) - FIND_PACKAGE( SSH ) + FIND_PACKAGE( SSH REQUIRED) INCLUDE_DIRECTORIES( ${SSH_INCLUDE_DIR} ) - # FindSSH.cmake doesn't check for REQUIRED flags - so we need to check ourselves - IF( MINGW OR UNIX ) - IF (NOT SSH_FOUND) - MESSAGE(FATAL_ERROR "missing library libssh required for SshIo") - ELSE (NOT SSH_FOUND) - SET ( USE_SSH 1 ) - ENDIF( NOT SSH_FOUND ) - ENDIF( MINGW OR UNIX ) + SET ( USE_SSH 1 ) ENDIF( EXIV2_ENABLE_SSH ) ENDIF( EXIV2_ENABLE_WEBREADY ) @@ -116,8 +102,14 @@ IF( EXIV2_ENABLE_NLS ) ENDIF( WIN32 ) ENDIF( NOT LOCALEDIR ) ADD_DEFINITIONS( -DEXV_LOCALEDIR="${LOCALEDIR}" ) + SET( ENABLE_NLS 1 ) ENDIF( EXIV2_ENABLE_NLS ) +# Force unicode support on windows +IF( EXIV2_ENABLE_WIN_UNICODE ) + SET ( UNICODE_PATH 1 ) +ENDIF() + IF( EXIV2_ENABLE_COMMERCIAL ) ADD_DEFINITIONS( -DEXV_COMMERCIAL_VERSION ) ENDIF( EXIV2_ENABLE_COMMERCIAL ) @@ -265,6 +257,7 @@ SET( EXV_SYMBOLS ENABLE_NLS HAVE_XMP_TOOLKIT HAVE__BOOL HAVE_REGEX + UNICODE_PATH USE_CURL USE_SSH PACKAGE @@ -283,9 +276,16 @@ FOREACH( entry ${EXV_SYMBOLS} ) ENDFOREACH( entry ${EXV_SYMBOLS} ) CONFIGURE_FILE( config/config.h.cmake ${CMAKE_SOURCE_DIR}/include/exiv2/exv_conf.h ) -CONFIGURE_FILE( config/exv_msvc.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/exv_msvc.h COPYONLY ) + +# when removing support of VS solution files, get rid of this stuff +#VSslnCompat +IF (MSVC) + CONFIGURE_FILE( config/config.h.cmake ${CMAKE_SOURCE_DIR}/include/exiv2/exv_msvc.h ) + CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/include/exiv2/exv_msvc.h ${CMAKE_BINARY_DIR}/ignore/exv_msvc.h COPYONLY ) +ENDIF() + +INSTALL( FILES ${CMAKE_BINARY_DIR}/ignore/exv_msvc.h DESTINATION include/exiv2 ) INSTALL( FILES ${CMAKE_SOURCE_DIR}/include/exiv2/exv_conf.h DESTINATION include/exiv2 ) -INSTALL( FILES ${CMAKE_SOURCE_DIR}/include/exiv2/exv_msvc.h DESTINATION include/exiv2 ) INSTALL( FILES ${CMAKE_SOURCE_DIR}/src/svn_version.h DESTINATION include/exiv2 ) CONFIGURE_FILE(config/exiv2_uninstall.cmake ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake COPYONLY) @@ -328,5 +328,7 @@ if ( EXIV2_ENABLE_WEBREADY ) OptionOutput( "USE Libcurl for HttpIo: " EXIV2_ENABLE_CURL ) OptionOutput( "USE Libssh for SshIo: " EXIV2_ENABLE_SSH ) endif ( EXIV2_ENABLE_WEBREADY ) - +IF (WIN32) +OptionOutput( "Unicode paths (wstring): " EXIV2_ENABLE_WIN_UNICODE ) +ENDIF() MESSAGE( STATUS "------------------------------------------------------------------" ) diff --git a/config/exv_msvc.h.cmake b/config/exv_msvc.h.cmake deleted file mode 100644 index f2fa241b..00000000 --- a/config/exv_msvc.h.cmake +++ /dev/null @@ -1,5 +0,0 @@ -/* -This file redirects to the configuration header file generated by cmake. -*/ - -#include "exv_conf.h" diff --git a/include/exiv2/config.h b/include/exiv2/config.h index d03a8cdd..d8796041 100644 --- a/include/exiv2/config.h +++ b/include/exiv2/config.h @@ -1,5 +1,6 @@ // config.h -// + +// #VSslnCompat - get rid of exv_msvc*.h files #ifdef _MSC_VER # ifdef EXV_MSVC_CONFIGURE # include "exv_msvc_configure.h" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index caef1bfc..fa3de536 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,5 @@ # CMake build system for exiv2 library and executables +# Copyright 2015- Daniel Kaneider # Copyright 2012- Robin Mills # Copyright 2010-2012 Gilles Caulier # Copyright 2008 Patrick Spendrin @@ -181,10 +182,6 @@ ENDIF( EXIV2_ENABLE_PNG ) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) -IF( MSVC ) # to support the old VS solution builds - ADD_DEFINITIONS("-DCMAKE_BUILD_SVN") -ENDIF() - ## # add xmp source if xmp is requested and xmp library not built IF( EXIV2_ENABLE_XMP ) @@ -268,11 +265,7 @@ ENDIF() IF( EXIV2_ENABLE_PNG ) IF( ZLIB_FOUND ) IF( MSVC ) - if ( EXIV2_ENABLE_SHARED ) - TARGET_LINK_LIBRARIES( exiv2lib PRIVATE optimized ${ZLIB_LIBRARIES}.lib debug ${ZLIB_LIBRARIES}d.lib ) - else() - TARGET_LINK_LIBRARIES( exiv2lib PRIVATE optimized zlibstatic.lib debug zlibstaticd.lib ) - endif() + TARGET_LINK_LIBRARIES( exiv2lib PRIVATE optimized ${ZLIB_LIBRARIES} debug ${ZLIB_LIBRARIES}d ) ELSE() TARGET_LINK_LIBRARIES( exiv2lib PRIVATE ${ZLIB_LIBRARIES} ) ENDIF()