From 8f0da32dab709950f2a8086485dd95bc2b7745f2 Mon Sep 17 00:00:00 2001 From: HumanDynamo Date: Tue, 20 Apr 2010 14:48:57 +0000 Subject: [PATCH] missing macro --- CMakeLists.txt | 12 ++++---- config/ConfigureChecks.cmake | 8 +++++- config/FindMSGFMT.cmake | 54 ++++++++++++++++++++++++++++++++++++ po/CMakeLists.txt | 2 +- 4 files changed, 68 insertions(+), 8 deletions(-) create mode 100644 config/FindMSGFMT.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e12ffd7a..560f412f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,14 +46,14 @@ SET( GENERIC_LIB_SOVERSION "6" ) # options and there 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_EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" OFF ) +OPTION( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" OFF ) 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" OFF ) -OPTION( EXIV2_ENABLE_PO_RULES "Includes rules to build i18n files" OFF ) +OPTION( EXIV2_ENABLE_PO_RULES "Includes rules to build i18n files" ON ) IF( MINGW OR UNIX ) ADD_DEFINITIONS(-Wall @@ -106,14 +106,14 @@ ENDIF( ${EXV_HAVE_STDINT_H} ) ADD_SUBDIRECTORY( xmpsdk ) ADD_SUBDIRECTORY( src ) -IF( EXIV2_ENABLE_PO_RULES ) - ADD_SUBDIRECTORY( po ) -ENDIF( EXIV2_ENABLE_PO_RULES ) - IF( EXIV2_ENABLE_BUILD_SAMPLES ) ADD_SUBDIRECTORY( samples ) ENDIF( EXIV2_ENABLE_BUILD_SAMPLES ) +IF( EXIV2_BUILD_PO ) + ADD_SUBDIRECTORY( po ) +ENDIF( EXIV2_BUILD_PO ) + IF( EXIV2_ENABLE_XMP ) ADD_DEPENDENCIES(exiv2 xmp) ENDIF( EXIV2_ENABLE_XMP ) diff --git a/config/ConfigureChecks.cmake b/config/ConfigureChecks.cmake index 2f6b2609..d0c67d14 100644 --- a/config/ConfigureChecks.cmake +++ b/config/ConfigureChecks.cmake @@ -96,6 +96,12 @@ IF( ICONV_ACCEPTS_CONST_INPUT ) MESSAGE ( "ICONV_ACCEPTS_CONST_INPUT : yes" ) ENDIF( ICONV_ACCEPTS_CONST_INPUT ) +FIND_PACKAGE(MSGFMT) +IF(MSGFMT_FOUND) + MESSAGE(STATUS "Program msgfmt found (${MSGFMT_EXECUTABLE})") + SET( EXIV2_BUILD_PO 1 ) +ENDIF(MSGFMT_FOUND) + # checking for Header files check_include_file( "inttypes.h" have_inttypes_h ) check_include_file( "libintl.h" HAVE_LIBINTL_H ) @@ -270,5 +276,5 @@ OptionOutput( "Conversion of Windows XP tags: " EXIV2_ENABLE_PRINTUCS2 OptionOutput( "Nikon lens database: " EXIV2_ENABLE_LENSDATA ) OptionOutput( "Commercial build: " EXIV2_ENABLE_COMMERCIAL ) OptionOutput( "Build the unit tests " EXIV2_ENABLE_BUILD_SAMPLES ) -OptionOutput( "Includes rules to build i18n files " EXIV2_ENABLE_PO_RULES ) +OptionOutput( "Includes rules to build i18n files " EXIV2_BUILD_PO ) MESSAGE( STATUS "-----------------------------------------------------------------" ) diff --git a/config/FindMSGFMT.cmake b/config/FindMSGFMT.cmake new file mode 100644 index 00000000..5a226f47 --- /dev/null +++ b/config/FindMSGFMT.cmake @@ -0,0 +1,54 @@ +# - FindMSGFMT.cmake for Hugin 0.7 +# file taken from rosegarden +# +# Find the gnu gettext msgfmt program and define +# a macro that calls it to add message translations +# +# Defined variables: +# MSGFMT_FOUND +# MSGFMT_EXECUTABLE +# +# Macro: +# ADD_TRANSLATIONS +# +# mod for Windows build 07Nov2007 TKSharpless -- +# look in C:\MinGW after std. Unix places, that's where +# gettext automatically installed itself on my system. +# TODO find where else on Windows, Mac, etc gettext might be + +IF(MSGFMT_EXECUTABLE) + SET(MSGFMT_FOUND TRUE) +ELSE(MSGFMT_EXECUTABLE) + FIND_PROGRAM(MSGFMT_EXECUTABLE + NAMES msgfmt gmsgfmt msgfmt.exe + PATHS /bin /usr/bin /usr/local/bin c:/MinGW/bin ${SOURCE_BASE_DIR}/gettext/bin) + IF(MSGFMT_EXECUTABLE) + SET(MSGFMT_FOUND TRUE) + ELSE(MSGFMT_EXECUTABLE) + IF(NOT MSGFMT_FIND_QUIETLY) + IF(MSGFMT_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "msgfmt program couldn't be found") + ENDIF(MSGFMT_FIND_REQUIRED) + ENDIF(NOT MSGFMT_FIND_QUIETLY) + ENDIF(MSGFMT_EXECUTABLE) + MARK_AS_ADVANCED(MSGFMT_EXECUTABLE) +ENDIF (MSGFMT_EXECUTABLE) + +MACRO(ADD_TRANSLATIONS _baseName) + SET(_outputs) + FOREACH(_file ${ARGN}) + GET_FILENAME_COMPONENT(_file_we ${_file} NAME_WE) + SET(_out "${CMAKE_CURRENT_BINARY_DIR}/${_file_we}.gmo") + SET(_in "${CMAKE_CURRENT_SOURCE_DIR}/${_file_we}.po") + ADD_CUSTOM_COMMAND( + OUTPUT ${_out} + COMMAND ${MSGFMT_EXECUTABLE} -o ${_out} ${_in} + DEPENDS ${_in} ) + INSTALL(FILES ${_out} + DESTINATION ${LOCALEDIR}/${_file_we}/LC_MESSAGES/ + RENAME ${_baseName}.mo ) + SET(_outputs ${_outputs} ${_out}) + ENDFOREACH(_file) + SET(MSGFMT_TARGET translations${_baseName}) + ADD_CUSTOM_TARGET(${MSGFMT_TARGET} ALL DEPENDS ${_outputs}) +ENDMACRO(ADD_TRANSLATIONS) diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 94336470..542fa304 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -32,4 +32,4 @@ # automatically include all po files in the directory FILE(GLOB PO_FILES *.po) -ADD_TRANSLATIONS(hugin ${PO_FILES}) +ADD_TRANSLATIONS(exiv2 ${PO_FILES})