diff options
author | David Cole <david.cole@kitware.com> | 2012-02-01 19:51:27 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2012-02-01 19:51:27 (GMT) |
commit | 0a11d3306632a1368960c18cee9d9605ac78cc25 (patch) | |
tree | 884f314a6d601fe034bf324d132da75f406cf9d7 /Modules | |
parent | cf4c0f335d9e6c253e9c5953eceab9765fe8cc54 (diff) | |
parent | 77e6c6fe844a0bcfd455da290a87adef5c1abd28 (diff) | |
download | CMake-0a11d3306632a1368960c18cee9d9605ac78cc25.zip CMake-0a11d3306632a1368960c18cee9d9605ac78cc25.tar.gz CMake-0a11d3306632a1368960c18cee9d9605ac78cc25.tar.bz2 |
Merge topic 'improve-findgettext'
77e6c6f FindGettext: support version selection
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindGettext.cmake | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index c44adb4..635090b 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -4,6 +4,7 @@ # GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool. # GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool. # GETTEXT_FOUND: True if gettext has been found. +# GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8) # # Additionally it provides the following macros: # GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN ) @@ -42,8 +43,21 @@ FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge) FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt) +IF(GETTEXT_MSGMERGE_EXECUTABLE) + EXECUTE_PROCESS(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version + OUTPUT_VARIABLE gettext_version + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + IF (gettext_version MATCHES "^msgmerge \\(.*\\) [0-9]") + STRING(REGEX REPLACE "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" GETTEXT_VERSION_STRING "${gettext_version}") + ENDIF() + UNSET(gettext_version) +ENDIF(GETTEXT_MSGMERGE_EXECUTABLE) + INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext + REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE + VERSION_VAR GETTEXT_VERSION_STRING) INCLUDE(CMakeParseArguments) |