Skip to content

Commit

Permalink
Merge pull request #37 from a17r/cmakebeautification
Browse files Browse the repository at this point in the history
cmakebeautification
  • Loading branch information
piponazo authored Aug 23, 2017
2 parents a973168 + a768b85 commit cd5a3ed
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 99 deletions.
107 changes: 53 additions & 54 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,91 +19,90 @@ endif()

set(CMAKE_MACOSX_RPATH 1)

SET( PACKAGE_COPYRIGHT "Andreas Huggel" )
SET( PACKAGE_BUGREPORT "http://github.com/exiv2/exiv2" )
SET( PACKAGE "exiv2" )
SET( PACKAGE_NAME "exiv2" )
SET( PACKAGE_VERSION "0.26" )
SET( PACKAGE_URL "http://www.exiv2.org" )
SET( PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}" )
SET( GENERIC_LIB_VERSION "26.0.0" )
SET( GENERIC_LIB_SOVERSION "26" )
set( PACKAGE_COPYRIGHT "Andreas Huggel" )
set( PACKAGE_BUGREPORT "http://github.com/exiv2/exiv2" )
set( PACKAGE "exiv2" )
set( PACKAGE_NAME "exiv2" )
set( PACKAGE_VERSION "0.26" )
set( PACKAGE_URL "http://www.exiv2.org" )
set( PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}" )
set( GENERIC_LIB_VERSION "26.0.0" )
set( GENERIC_LIB_SOVERSION "26" )

# options and their default values
OPTION( EXIV2_ENABLE_SHARED "Build exiv2 as a shared library (dll)" ON )
OPTION( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )
OPTION( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" ON )
OPTION( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON )
OPTION( EXIV2_ENABLE_NLS "Build native language support (requires gettext)" ON )
OPTION( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON )
OPTION( EXIV2_ENABLE_LENSDATA "Build including lens data" ON )
OPTION( EXIV2_ENABLE_COMMERCIAL "Build with the EXV_COMMERCIAL_VERSION symbol set" OFF )
OPTION( EXIV2_ENABLE_BUILD_SAMPLES "Build the unit tests" ON )
OPTION( EXIV2_ENABLE_BUILD_PO "Build translations files" OFF )
OPTION( EXIV2_ENABLE_VIDEO "Build video support into library" OFF )
OPTION( EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF )
OPTION( EXIV2_ENABLE_DYNAMIC_RUNTIME "Use dynamic runtime (used for static libs)" OFF )
IF (WIN32)
OPTION( EXIV2_ENABLE_WIN_UNICODE "Use Unicode paths (wstring) on Windows" OFF )
OPTION( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo" OFF )
OPTION( EXIV2_ENABLE_SSH "USE Libssh for SshIo" OFF )
ELSE()
OPTION( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo" ON )
OPTION( EXIV2_ENABLE_SSH "USE Libssh for SshIo" ON )
ENDIF()
OPTION( EXIV2_ENABLE_TOOLS "Build exiv2 executable" ON )
option( EXIV2_ENABLE_SHARED "Build exiv2 as a shared library (dll)" ON )
option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )
option( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" ON )
option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON )
option( EXIV2_ENABLE_NLS "Build native language support (requires gettext)" ON )
option( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON )
option( EXIV2_ENABLE_LENSDATA "Build including lens data" ON )
option( EXIV2_ENABLE_COMMERCIAL "Build with the EXV_COMMERCIAL_VERSION symbol set" OFF )
option( EXIV2_ENABLE_BUILD_SAMPLES "Build the unit tests" ON )
option( EXIV2_ENABLE_BUILD_PO "Build translations files" OFF )
option( EXIV2_ENABLE_VIDEO "Build video support into library" OFF )
option( EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF )
option( EXIV2_ENABLE_DYNAMIC_RUNTIME "Use dynamic runtime (used for static libs)" OFF )
if (WIN32)
option( EXIV2_ENABLE_WIN_UNICODE "Use Unicode paths (wstring) on Windows" OFF )
option( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo" OFF )
option( EXIV2_ENABLE_SSH "USE Libssh for SshIo" OFF )
else()
option( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo" ON )
option( EXIV2_ENABLE_SSH "USE Libssh for SshIo" ON )
endif()
option( EXIV2_ENABLE_TOOLS "Build exiv2 executable" ON )

include(config/findDependencies.cmake)
include(config/compilerFlags.cmake)


IF( EXIV2_ENABLE_COMMERCIAL )
SET (EXIV2_ENABLE_LENSDATA OFF)
SET (EXIV2_ENABLE_NLS OFF)
ENDIF()
if( EXIV2_ENABLE_COMMERCIAL )
set (EXIV2_ENABLE_LENSDATA OFF)
set (EXIV2_ENABLE_NLS OFF)
endif()

if( MSVC )
set(CMAKE_DEBUG_POSTFIX "d")
endif( MSVC )
endif()

IF( EXIV2_ENABLE_XMP )
SET( HAVE_XMP_TOOLKIT ON )
ENDIF( EXIV2_ENABLE_XMP )
if( EXIV2_ENABLE_XMP )
set( HAVE_XMP_TOOLKIT ON )
endif()

include( config/generateConfigFile.cmake )
include_directories(${CMAKE_BINARY_DIR}) # Make the exv_conf.h file visible for the full project

include( config/CMakeChecks.txt )

if( EXIV2_ENABLE_XMP )
ADD_SUBDIRECTORY( xmpsdk )
add_subdirectory( xmpsdk )
endif()
ADD_SUBDIRECTORY( src )
add_subdirectory( src )

IF( EXIV2_ENABLE_BUILD_SAMPLES )
ADD_SUBDIRECTORY( samples )
ENDIF( EXIV2_ENABLE_BUILD_SAMPLES )
if( EXIV2_ENABLE_BUILD_SAMPLES )
add_subdirectory( samples )
endif()

IF( EXIV2_ENABLE_BUILD_PO )
ADD_SUBDIRECTORY( po )
ENDIF( EXIV2_ENABLE_BUILD_PO )
if( EXIV2_ENABLE_BUILD_PO )
add_subdirectory( po )
endif()

##
# tests
ADD_CUSTOM_TARGET(tests COMMAND env EXIV2_BINDIR="${CMAKE_BINARY_DIR}"/bin make tests WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" )
ADD_CUSTOM_TARGET(geotag-test COMMAND env EXIV2_BINDIR="${CMAKE_BINARY_DIR}"/bin make geotag-test WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" )
add_custom_target(tests COMMAND env EXIV2_BINDIR="${CMAKE_BINARY_DIR}"/bin make tests WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" )
add_custom_target(geotag-test COMMAND env EXIV2_BINDIR="${CMAKE_BINARY_DIR}"/bin make geotag-test WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" )

##
# http://dev.exiv2.org/boards/3/topics/1364
# effectively does a make doc on the root directory
# has to run 'make config' and './configure'
# and copy bin/taglist to <exiv2dir>/bin/taglist for use by 'make doc'
IF( MINGW OR UNIX OR APPLE)
ADD_CUSTOM_TARGET(doc
if( MINGW OR UNIX OR APPLE)
add_custom_target(doc
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/doc"
COMMAND chmod +x ./cmake_doc.sh
COMMAND ./cmake_doc.sh "${CMAKE_BINARY_DIR}"
)
ENDIF()
endif()

INCLUDE( config/printSummary.cmake )
include( config/printSummary.cmake )
34 changes: 17 additions & 17 deletions config/CMakeChecks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@
#
# ConfigureChecks for exiv2

IF( EXIV2_ENABLE_SHARED )
ADD_DEFINITIONS( -DEXV_HAVE_DLL )
SET( STATIC_FLAG SHARED )
ELSE( EXIV2_ENABLE_SHARED )
SET( STATIC_FLAG STATIC )
ENDIF( EXIV2_ENABLE_SHARED )
if( EXIV2_ENABLE_SHARED )
add_definitions( -DEXV_HAVE_DLL )
set( STATIC_FLAG SHARED )
else()
set( STATIC_FLAG STATIC )
endif()

IF( EXIV2_ENABLE_COMMERCIAL )
ADD_DEFINITIONS( -DEXV_COMMERCIAL_VERSION )
ENDIF( EXIV2_ENABLE_COMMERCIAL )
if( EXIV2_ENABLE_COMMERCIAL )
add_definitions( -DEXV_COMMERCIAL_VERSION )
endif()

CONFIGURE_FILE(config/exiv2_uninstall.cmake ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake COPYONLY)
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
configure_file(config/exiv2_uninstall.cmake ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake COPYONLY)
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")

IF( NOT MSVC )
CONFIGURE_FILE( config/exiv2.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/exiv2.pc @ONLY )
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig )
CONFIGURE_FILE( config/exiv2.lsm.cmake ${CMAKE_CURRENT_BINARY_DIR}/exiv2.lsm)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2.lsm DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig )
ENDIF( NOT MSVC )
if( NOT MSVC )
configure_file( config/exiv2.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/exiv2.pc @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig )
configure_file( config/exiv2.lsm.cmake ${CMAKE_CURRENT_BINARY_DIR}/exiv2.lsm)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2.lsm DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig )
endif()

2 changes: 1 addition & 1 deletion po/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ UPDATE_TRANSLATIONS(exiv2 ${PO_FILES})

ADD_TRANSLATIONS(exiv2 ${PO_FILES})

ADD_CUSTOM_TARGET( pot-update
add_custom_target( pot-update
COMMAND xgettext -d ${PACKAGE_NAME}
-s
-D ${CMAKE_CURRENT_SOURCE_DIR}/..
Expand Down
6 changes: 3 additions & 3 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

SET( SAMPLES addmoddel.cpp
set( SAMPLES addmoddel.cpp
convert-test.cpp
easyaccess-test.cpp
exifcomment.cpp
Expand Down Expand Up @@ -80,7 +80,7 @@ target_link_libraries(conntest PRIVATE exiv2lib)
# ******************************************************************************
# exifprint application
# ADD_EXECUTABLE( exifprint exifprint.cpp )
# TARGET_LINK_LIBRARIES( exifprint exiv2lib )
# target_link_libraries( exifprint exiv2lib )

# ******************************************************************************
# remotetest application
Expand All @@ -89,4 +89,4 @@ target_link_libraries(remotetest exiv2lib)

# ******************************************************************************
# Man page
INSTALL( FILES exiv2samples.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 )
install( FILES exiv2samples.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 )
48 changes: 24 additions & 24 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

# Private headers which are only needed for the library itself
SET( LIBEXIV2_PRIVATE_HDR canonmn_int.hpp
set( LIBEXIV2_PRIVATE_HDR canonmn_int.hpp
casiomn_int.hpp
cr2image_int.hpp
crwimage_int.hpp
Expand All @@ -33,7 +33,7 @@ SET( LIBEXIV2_PRIVATE_HDR canonmn_int.hpp
)

# Add standalone C++ header files to this list
SET( LIBEXIV2_HDR ../include/exiv2/asfvideo.hpp
set( LIBEXIV2_HDR ../include/exiv2/asfvideo.hpp
../include/exiv2/basicio.hpp
../include/exiv2/bmpimage.hpp
../include/exiv2/config.h
Expand Down Expand Up @@ -82,7 +82,7 @@ SET( LIBEXIV2_HDR ../include/exiv2/asfvideo.hpp
)

# Add library C++ source files to this list
SET( LIBEXIV2_SRC asfvideo.cpp
set( LIBEXIV2_SRC asfvideo.cpp
basicio.cpp
bmpimage.cpp
canonmn.cpp
Expand Down Expand Up @@ -151,7 +151,7 @@ if( EXIV2_ENABLE_WEBREADY )
set( LIBEXIV2_SRC ${LIBEXIV2_SRC} ssh.cpp)
set( LIBEXIV2_HDR ${LIBEXIV2_HDR} ../include/exiv2/ssh.hpp)
endif()
endif( EXIV2_ENABLE_WEBREADY )
endif()

##
# add png*.cpp files if PNG support requested
Expand All @@ -160,7 +160,7 @@ if( EXIV2_ENABLE_PNG )
set( LIBEXIV2_HDR ${LIBEXIV2_HDR} ../include/exiv2/pngimage.hpp )
endif()

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})

# ******************************************************************************
# exiv2lib library
Expand All @@ -172,7 +172,7 @@ else()
add_library( exiv2lib ${STATIC_FLAG} ${LIBEXIV2_SRC} ${LIBEXIV2_HDR} ${LIBEXIV2_PRIVATE_HDR})
endif()

SET_TARGET_PROPERTIES( exiv2lib PROPERTIES
set_target_properties( exiv2lib PROPERTIES
VERSION ${GENERIC_LIB_VERSION}
SOVERSION ${GENERIC_LIB_SOVERSION}
DEFINE_SYMBOL EXV_BUILDING_LIB
Expand All @@ -187,7 +187,7 @@ endif()

if ( EXIV2_ENABLE_XMP )
target_include_directories(exiv2lib PRIVATE ${CMAKE_SOURCE_DIR}/xmpsdk/include)
endif ()
endif()

# TODO : We should not include include/exiv2 but only include !!!
target_include_directories(exiv2lib PUBLIC
Expand All @@ -207,9 +207,9 @@ if ( MSVC )
target_compile_definitions(exiv2lib PRIVATE PSAPI_VERSION=1) # to be compatible with <= WinVista (#905)

if ( EXIV2_ENABLE_STATIC )
TARGET_LINK_LIBRARIES( exiv2lib zlibstatic ${ZLIB_LIBRARIES} )
target_link_libraries( exiv2lib zlibstatic ${ZLIB_LIBRARIES} )
else()
TARGET_LINK_LIBRARIES( exiv2lib PRIVATE ${ZLIB_LIBRARIES} )
target_link_libraries( exiv2lib PRIVATE ${ZLIB_LIBRARIES} )
endif()
source_group("Header Files" FILES ${LIBEXIV2_HDR} )
source_group("Header Files" FILES ${LIBCURL_HDR} )
Expand All @@ -225,24 +225,24 @@ else()
endif()

if( EXIV2_ENABLE_XMP AND EXIV2_ENABLE_LIBXMP )
TARGET_LINK_LIBRARIES( exiv2lib PUBLIC xmp )
ENDIF()
target_link_libraries( exiv2lib PUBLIC xmp )
endif()

IF( EXIV2_ENABLE_PNG )
TARGET_LINK_LIBRARIES( exiv2lib PRIVATE ${ZLIB_LIBRARIES} )
ENDIF()
if( EXIV2_ENABLE_PNG )
target_link_libraries( exiv2lib PRIVATE ${ZLIB_LIBRARIES} )
endif()

IF( EXIV2_ENABLE_NLS )
TARGET_LINK_LIBRARIES( exiv2lib PRIVATE ${LIBINTL_LIBRARIES} )
ENDIF( EXIV2_ENABLE_NLS )
if( EXIV2_ENABLE_NLS )
target_link_libraries( exiv2lib PRIVATE ${LIBINTL_LIBRARIES} )
endif()

IF( ICONV_FOUND )
TARGET_LINK_LIBRARIES( exiv2lib PRIVATE ${ICONV_LIBRARIES} )
ENDIF( ICONV_FOUND )
if( ICONV_FOUND )
target_link_libraries( exiv2lib PRIVATE ${ICONV_LIBRARIES} )
endif()

IF (CYGWIN OR MINGW)
TARGET_LINK_LIBRARIES( exiv2lib PRIVATE psapi ws2_32 )
ENDIF(CYGWIN OR MINGW)
if (CYGWIN OR MINGW)
target_link_libraries( exiv2lib PRIVATE psapi ws2_32 )
endif()

install(TARGETS exiv2lib
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand Down Expand Up @@ -287,4 +287,4 @@ endif()

# ******************************************************************************
# Man page
INSTALL( FILES exiv2.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 )
install( FILES exiv2.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 )

0 comments on commit cd5a3ed

Please sign in to comment.