diff options
author | Kitware Robot <kwrobot@kitware.com> | 2012-08-13 17:47:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-08-13 18:19:16 (GMT) |
commit | 77543bde41b0e52c3959016698b529835945d62d (patch) | |
tree | ff63e5fbec326c4a5d821e7496c6d2cb52f75b92 /Modules/FindGettext.cmake | |
parent | 7bbaa4283de26864b2e55e819db0884771585467 (diff) | |
download | CMake-77543bde41b0e52c3959016698b529835945d62d.zip CMake-77543bde41b0e52c3959016698b529835945d62d.tar.gz CMake-77543bde41b0e52c3959016698b529835945d62d.tar.bz2 |
Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands. Later command
names became case-insensitive. Now the preferred style is lower-case.
Run the following shell code:
cmake --help-command-list |
grep -v "cmake version" |
while read c; do
echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
Diffstat (limited to 'Modules/FindGettext.cmake')
-rw-r--r-- | Modules/FindGettext.cmake | 224 |
1 files changed, 112 insertions, 112 deletions
diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 6dbc026..a801a29 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -39,182 +39,182 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge) +find_program(GETTEXT_MSGMERGE_EXECUTABLE msgmerge) -FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt) +find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt) -IF(GETTEXT_MSGMERGE_EXECUTABLE) - EXECUTE_PROCESS(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version +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) + 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) +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE VERSION_VAR GETTEXT_VERSION_STRING) -INCLUDE(CMakeParseArguments) +include(CMakeParseArguments) -FUNCTION(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name) - SET(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}") - GET_PROPERTY(currentCounter GLOBAL PROPERTY "${propertyName}") - IF(NOT currentCounter) - SET(currentCounter 1) - ENDIF() - SET(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE) - MATH(EXPR currentCounter "${currentCounter} + 1") - SET_PROPERTY(GLOBAL PROPERTY ${propertyName} ${currentCounter} ) -ENDFUNCTION() +function(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name) + set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}") + get_property(currentCounter GLOBAL PROPERTY "${propertyName}") + if(NOT currentCounter) + set(currentCounter 1) + endif() + set(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE) + math(EXPR currentCounter "${currentCounter} + 1") + set_property(GLOBAL PROPERTY ${propertyName} ${currentCounter} ) +endfunction() -MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) +macro(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) # make it a real variable, so we can modify it here - SET(_firstPoFile "${_firstPoFileArg}") - - SET(_gmoFiles) - GET_FILENAME_COMPONENT(_potName ${_potFile} NAME) - STRING(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) - GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE) - - SET(_addToAll) - IF(${_firstPoFile} STREQUAL "ALL") - SET(_addToAll "ALL") - SET(_firstPoFile) - ENDIF(${_firstPoFile} STREQUAL "ALL") - - FOREACH (_currentPoFile ${_firstPoFile} ${ARGN}) - GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE) - GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH) - GET_FILENAME_COMPONENT(_lang ${_absFile} NAME_WE) - SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) - - ADD_CUSTOM_COMMAND( + set(_firstPoFile "${_firstPoFileArg}") + + set(_gmoFiles) + get_filename_component(_potName ${_potFile} NAME) + string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) + get_filename_component(_absPotFile ${_potFile} ABSOLUTE) + + set(_addToAll) + if(${_firstPoFile} STREQUAL "ALL") + set(_addToAll "ALL") + set(_firstPoFile) + endif(${_firstPoFile} STREQUAL "ALL") + + foreach (_currentPoFile ${_firstPoFile} ${ARGN}) + get_filename_component(_absFile ${_currentPoFile} ABSOLUTE) + get_filename_component(_abs_PATH ${_absFile} PATH) + get_filename_component(_lang ${_absFile} NAME_WE) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) + + add_custom_command( OUTPUT ${_gmoFile} COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} DEPENDS ${_absPotFile} ${_absFile} ) - INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) - SET(_gmoFiles ${_gmoFiles} ${_gmoFile}) + install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) + set(_gmoFiles ${_gmoFiles} ${_gmoFile}) - ENDFOREACH (_currentPoFile ) + endforeach (_currentPoFile ) - IF(NOT TARGET translations) - ADD_CUSTOM_TARGET(translations) - ENDIF() + if(NOT TARGET translations) + add_custom_target(translations) + endif() _GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName) - ADD_CUSTOM_TARGET(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles}) + add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles}) - ADD_DEPENDENCIES(translations ${uniqueTargetName}) + add_dependencies(translations ${uniqueTargetName}) -ENDMACRO(GETTEXT_CREATE_TRANSLATIONS ) +endmacro(GETTEXT_CREATE_TRANSLATIONS ) -FUNCTION(GETTEXT_PROCESS_POT_FILE _potFile) - SET(_gmoFiles) - SET(_options ALL) - SET(_oneValueArgs INSTALL_DESTINATION) - SET(_multiValueArgs LANGUAGES) +function(GETTEXT_PROCESS_POT_FILE _potFile) + set(_gmoFiles) + set(_options ALL) + set(_oneValueArgs INSTALL_DESTINATION) + set(_multiValueArgs LANGUAGES) CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) - GET_FILENAME_COMPONENT(_potName ${_potFile} NAME) - STRING(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) - GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE) + get_filename_component(_potName ${_potFile} NAME) + string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) + get_filename_component(_absPotFile ${_potFile} ABSOLUTE) - FOREACH (_lang ${_parsedArguments_LANGUAGES}) - SET(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po") - SET(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo") + foreach (_lang ${_parsedArguments_LANGUAGES}) + set(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po") + set(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo") - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT "${_poFile}" COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} ${_absPotFile} DEPENDS ${_absPotFile} ) - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT "${_gmoFile}" COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile} DEPENDS ${_absPotFile} ${_poFile} ) - IF(_parsedArguments_INSTALL_DESTINATION) - INSTALL(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) - ENDIF(_parsedArguments_INSTALL_DESTINATION) - LIST(APPEND _gmoFiles ${_gmoFile}) - ENDFOREACH (_lang ) + if(_parsedArguments_INSTALL_DESTINATION) + install(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) + endif(_parsedArguments_INSTALL_DESTINATION) + list(APPEND _gmoFiles ${_gmoFile}) + endforeach (_lang ) - IF(NOT TARGET potfiles) - ADD_CUSTOM_TARGET(potfiles) - ENDIF() + if(NOT TARGET potfiles) + add_custom_target(potfiles) + endif() _GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName) - IF(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) - ELSE(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles}) - ENDIF(_parsedArguments_ALL) + if(_parsedArguments_ALL) + add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) + else(_parsedArguments_ALL) + add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles}) + endif(_parsedArguments_ALL) - ADD_DEPENDENCIES(potfiles ${uniqueTargetName}) + add_dependencies(potfiles ${uniqueTargetName}) -ENDFUNCTION(GETTEXT_PROCESS_POT_FILE) +endfunction(GETTEXT_PROCESS_POT_FILE) -FUNCTION(GETTEXT_PROCESS_PO_FILES _lang) - SET(_options ALL) - SET(_oneValueArgs INSTALL_DESTINATION) - SET(_multiValueArgs PO_FILES) - SET(_gmoFiles) +function(GETTEXT_PROCESS_PO_FILES _lang) + set(_options ALL) + set(_oneValueArgs INSTALL_DESTINATION) + set(_multiValueArgs PO_FILES) + set(_gmoFiles) CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) - FOREACH(_current_PO_FILE ${_parsedArguments_PO_FILES}) - GET_FILENAME_COMPONENT(_name ${_current_PO_FILE} NAME) - STRING(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name}) - SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo) - ADD_CUSTOM_COMMAND(OUTPUT ${_gmoFile} + foreach(_current_PO_FILE ${_parsedArguments_PO_FILES}) + get_filename_component(_name ${_current_PO_FILE} NAME) + string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name}) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo) + add_custom_command(OUTPUT ${_gmoFile} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" DEPENDS ${_current_PO_FILE} ) - IF(_parsedArguments_INSTALL_DESTINATION) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${_basename}.mo) - ENDIF(_parsedArguments_INSTALL_DESTINATION) - LIST(APPEND _gmoFiles ${_gmoFile}) - ENDFOREACH(_current_PO_FILE) + if(_parsedArguments_INSTALL_DESTINATION) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${_basename}.mo) + endif(_parsedArguments_INSTALL_DESTINATION) + list(APPEND _gmoFiles ${_gmoFile}) + endforeach(_current_PO_FILE) - IF(NOT TARGET pofiles) - ADD_CUSTOM_TARGET(pofiles) - ENDIF() + if(NOT TARGET pofiles) + add_custom_target(pofiles) + endif() _GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName) - IF(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) - ELSE(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles}) - ENDIF(_parsedArguments_ALL) + if(_parsedArguments_ALL) + add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) + else(_parsedArguments_ALL) + add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles}) + endif(_parsedArguments_ALL) - ADD_DEPENDENCIES(pofiles ${uniqueTargetName}) + add_dependencies(pofiles ${uniqueTargetName}) -ENDFUNCTION(GETTEXT_PROCESS_PO_FILES) +endfunction(GETTEXT_PROCESS_PO_FILES) -IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) - SET(GETTEXT_FOUND TRUE) -ELSE (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) - SET(GETTEXT_FOUND FALSE) - IF (GetText_REQUIRED) - MESSAGE(FATAL_ERROR "GetText not found") - ENDIF (GetText_REQUIRED) -ENDIF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) +if (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) + set(GETTEXT_FOUND TRUE) +else (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) + set(GETTEXT_FOUND FALSE) + if (GetText_REQUIRED) + message(FATAL_ERROR "GetText not found") + endif (GetText_REQUIRED) +endif (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) |