Improve basename extraction in qt5_add_dbus_interfaces

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>
This commit is contained in:
Stephen Kelly 2012-07-03 14:16:21 +02:00 committed by Qt by Nokia
parent 6136bfffce
commit 897d0021dc

View 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)