[kdelibs/KDE/4.7] cmake/modules: Do not use GET_FILENAME_COMPONENT + NAME_WE to get the base filename

Albert Astals Cid tsdgeos at terra.es
Tue Nov 15 00:15:21 UTC 2011


Git commit 9872a43e854aa28c5ef4bcfe9d20e3c210f0ba7e by Albert Astals Cid.
Committed on 15/11/2011 at 01:09.
Pushed by aacid into branch 'KDE/4.7'.

Do not use GET_FILENAME_COMPONENT + NAME_WE to get the base filename

The problem is that NAME_WE treats everything after the first dot as file extension
but we know the extension will just be .po so in case of a file named
plasma_package_org.kde.activityswitcher.po
we want
plasma_package_org.kde.activityswitcher to be the basename and not plasma_package_org

I am pretty sure GETTEXT_PROCESS_POT_FILE and GETTEXT_CREATE_TRANSLATIONS macros have a similar
problem but since we do not use them in KDE I have no way to test it in a meaningful way

Acked by Alex

CCMAIL: kde-buildsystem at kde.org

M  +2    -1    cmake/modules/FindGettext.cmake

http://commits.kde.org/kdelibs/9872a43e854aa28c5ef4bcfe9d20e3c210f0ba7e

diff --git a/cmake/modules/FindGettext.cmake b/cmake/modules/FindGettext.cmake
index e35dced..119d765 100644
--- a/cmake/modules/FindGettext.cmake
+++ b/cmake/modules/FindGettext.cmake
@@ -213,7 +213,8 @@ MACRO(GETTEXT_PROCESS_PO_FILES _lang)
 #    message(STATUS "2 all ${_addToAll} dest ${_installDest} args: ${_args}")
    
    FOREACH(_current_PO_FILE ${_args})
-      GET_FILENAME_COMPONENT(_basename ${_current_PO_FILE} NAME_WE)
+      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}


More information about the Kde-buildsystem mailing list