cmake: test: Enable the build of qdbusabstractinterface
Since the code wants pinger_interface.h as include name and the qt_create_qdbusxml2cpp_command function was using the filename as source for the next filename i introduced a new option DBUS_ADAPTOR_BASENAME/DBUS_INTERFACE_BASENAME to set the name of the resulting file Change-Id: I582d578b68275e4530e91a88631ae43fd1ae06fd Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
parent
7d5978df7c
commit
e2dc030ac0
@ -243,7 +243,7 @@ function(qt_internal_module_info result target)
|
||||
endfunction()
|
||||
|
||||
|
||||
set(__default_private_args "SOURCES;LIBRARIES;INCLUDE_DIRECTORIES;DEFINES;DBUS_ADAPTOR_FLAGS;DBUS_ADAPTOR_SOURCES;DBUS_INTERFACE_FLAGS;DBUS_INTERFACE_SOURCES;FEATURE_DEPENDENCIES")
|
||||
set(__default_private_args "SOURCES;LIBRARIES;INCLUDE_DIRECTORIES;DEFINES;DBUS_ADAPTOR_BASENAME;DBUS_ADAPTOR_FLAGS;DBUS_ADAPTOR_SOURCES;DBUS_INTERFACE_BASENAME;DBUS_INTERFACE_FLAGS;DBUS_INTERFACE_SOURCES;FEATURE_DEPENDENCIES")
|
||||
set(__default_public_args "PUBLIC_LIBRARIES;PUBLIC_INCLUDE_DIRECTORIES;PUBLIC_DEFINES")
|
||||
|
||||
|
||||
@ -263,12 +263,12 @@ function(extend_target target)
|
||||
if (${result})
|
||||
set(dbus_sources "")
|
||||
foreach(adaptor ${arg_DBUS_ADAPTOR_SOURCES})
|
||||
qt_create_qdbusxml2cpp_command("${target}" "${adaptor}" ADAPTOR FLAGS "${arg_DBUS_ADAPTOR_FLAGS}")
|
||||
qt_create_qdbusxml2cpp_command("${target}" "${adaptor}" ADAPTOR BASENAME "${arg_DBUS_ADAPTOR_BASENAME}" FLAGS "${arg_DBUS_ADAPTOR_FLAGS}")
|
||||
list(APPEND dbus_sources "${sources}")
|
||||
endforeach()
|
||||
|
||||
foreach(interface ${arg_DBUS_INTERFACE_SOURCES})
|
||||
qt_create_qdbusxml2cpp_command("${target}" "${interface}" INTERFACE FLAGS "${arg_DBUS_INTERFACE_FLAGS}")
|
||||
qt_create_qdbusxml2cpp_command("${target}" "${interface}" INTERFACE BASENAME "${arg_DBUS_INTERFACE_BASENAME}" FLAGS "${arg_DBUS_INTERFACE_FLAGS}")
|
||||
list(APPEND dbus_sources "${sources}")
|
||||
endforeach()
|
||||
|
||||
@ -772,7 +772,7 @@ endfunction()
|
||||
|
||||
# helper to set up a qdbusxml2cpp rule
|
||||
function(qt_create_qdbusxml2cpp_command target infile)
|
||||
qt_parse_all_arguments(arg "qt_create_qdbusxml2cpp_command" "ADAPTOR;INTERFACE" "" "FLAGS" ${ARGN})
|
||||
qt_parse_all_arguments(arg "qt_create_qdbusxml2cpp_command" "ADAPTOR;INTERFACE" "BASENAME" "FLAGS" ${ARGN})
|
||||
if((arg_ADAPTOR AND arg_INTERFACE) OR (NOT arg_ADAPTOR AND NOT arg_INTERFACE))
|
||||
message(FATAL_ERROR "qt_create_dbusxml2cpp_command needs either ADAPTOR or INTERFACE.")
|
||||
endif()
|
||||
@ -784,11 +784,17 @@ function(qt_create_qdbusxml2cpp_command target infile)
|
||||
set(type "interface")
|
||||
endif()
|
||||
|
||||
get_filename_component(file_name "${infile}" NAME_WE)
|
||||
string(TOLOWER "${file_name}" file_name)
|
||||
if ("${arg_BASENAME}" STREQUAL "")
|
||||
get_filename_component(file_name "${infile}" NAME_WE)
|
||||
string(TOLOWER "${file_name}" file_name)
|
||||
set(file_name "${file_name}_${type}")
|
||||
else()
|
||||
set(file_name ${arg_BASENAME})
|
||||
endif()
|
||||
|
||||
set(header_file "${CMAKE_CURRENT_BINARY_DIR}/${file_name}_${type}.h")
|
||||
set(source_file "${CMAKE_CURRENT_BINARY_DIR}/${file_name}_${type}.cpp")
|
||||
|
||||
set(header_file "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.h")
|
||||
set(source_file "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.cpp")
|
||||
|
||||
add_custom_command(OUTPUT "${header_file}" "${source_file}"
|
||||
COMMAND Qt::qdbusxml2cpp ${arg_FLAGS} "${option}" "${header_file}:${source_file}" "${infile}"
|
||||
|
@ -19,7 +19,7 @@ add_subdirectory(qdbusthreading)
|
||||
|
||||
if(QT_FEATURE_process)
|
||||
add_subdirectory(qdbusabstractadaptor)
|
||||
# missing add_qt_binary: add_subdirectory("qdbusabstractinterface")
|
||||
add_subdirectory(qdbusabstractinterface)
|
||||
# missing add_qt_binary: add_subdirectory("qdbusinterface")
|
||||
|
||||
if(QT_FEATURE_private_tests)
|
||||
|
@ -1,4 +1,21 @@
|
||||
# Generated from qdbusabstractinterface.pro.
|
||||
|
||||
add_subdirectory(qpinger)
|
||||
add_subdirectory(qdbusabstractinterface)
|
||||
|
||||
add_qt_test(tst_qdbusabstractinterface
|
||||
SOURCES
|
||||
interface.cpp
|
||||
tst_qdbusabstractinterface.cpp
|
||||
LIBRARIES
|
||||
Qt::Core
|
||||
Qt::DBus
|
||||
)
|
||||
|
||||
extend_target(tst_qdbusabstractinterface
|
||||
DBUS_INTERFACE_SOURCES
|
||||
org.qtproject.QtDBus.Pinger.xml
|
||||
DBUS_INTERFACE_BASENAME
|
||||
pinger_interface
|
||||
DBUS_INTERFACE_FLAGS
|
||||
-i interface.h
|
||||
)
|
||||
|
@ -1,13 +0,0 @@
|
||||
# Generated from qdbusabstractinterface.pro.
|
||||
|
||||
#####################################################################
|
||||
## ../tst_qdbusabstractinterface Test:
|
||||
#####################################################################
|
||||
|
||||
add_qt_test(../tst_qdbusabstractinterface
|
||||
SOURCES
|
||||
../interface.cpp ../interface.h
|
||||
../tst_qdbusabstractinterface.cpp
|
||||
LIBRARIES
|
||||
Qt::DBus
|
||||
)
|
@ -9,5 +9,6 @@ add_qt_executable(qpinger
|
||||
../interface.cpp ../interface.h
|
||||
qpinger.cpp
|
||||
LIBRARIES
|
||||
Qt::Core
|
||||
Qt::DBus
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user