Improve basename extraction in qt5_add_dbus_interfaces
authorStephen Kelly <stephen.kelly@kdab.com>
Tue, 3 Jul 2012 12:16:21 +0000 (14:16 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 3 Jul 2012 20:55:13 +0000 (22:55 +0200)
This is a forward port of f46903b4b21e5d1c8af9a60e9ea87805b170ed73
in cmake.git.

Change-Id: I627b17259182497c1353ccf4cd3fa4a61546be5d
Reviewed-by: Clinton Stimpson <clinton@elemtech.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
src/dbus/Qt5DBusMacros.cmake

index 6617d37..17068c5 100644 (file)
@@ -73,9 +73,10 @@ endfunction()
 function(QT5_ADD_DBUS_INTERFACES _sources)
     foreach(_current_FILE ${ARGN})
         get_filename_component(_infile ${_current_FILE} ABSOLUTE)
+        get_filename_component(_basename ${_current_FILE} NAME)
         # get the part before the ".xml" suffix
-        string(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2" _basename ${_current_FILE})
         string(TOLOWER ${_basename} _basename)
+        string(REGEX REPLACE "(.*\\.)?([^\\.]+)\\.xml" "\\2" _basename ${_basename})
         qt5_add_dbus_interface(${_sources} ${_infile} ${_basename}interface)
     endforeach()
     set(${_sources} ${${_sources}} PARENT_SCOPE)