diff options
author | David Cole <david.cole@kitware.com> | 2012-06-21 11:55:24 -0400 |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2012-06-21 11:55:24 -0400 |
commit | fd8fc2791b155edf0035fb0365e1fd220adbd444 (patch) | |
tree | 0345caaf4100d6b59b229b34a669d5afa652daca /Modules | |
parent | ae6f9b015f0e2ed30934b756d8cf3b268cda6472 (diff) | |
parent | 0331a5adde45583e3bca351f2814aea971474671 (diff) | |
download | cmake-fd8fc2791b155edf0035fb0365e1fd220adbd444.tar.gz |
Merge topic 'qt4-macros'
0331a5a Qt4Macros: add some quotes to prevent damage from spaces in the paths
f46903b Qt4Macros: improve basename extraction in QT4_ADD_DBUS_INTERFACES
aa841ae FindQt4: extend documentation
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindQt4.cmake | 25 | ||||
-rw-r--r-- | Modules/Qt4Macros.cmake | 37 |
2 files changed, 38 insertions, 24 deletions
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 391797eebe..2f1708d70e 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -102,15 +102,28 @@ # accompanying header file foo.h. # If a source file has the SKIP_AUTOMOC property set it will be ignored by this macro. # +# You should have a look on the AUTOMOC property for targets to achieve the same results. +# # macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename) -# create a the interface header and implementation files with the +# Create a the interface header and implementation files with the # given basename from the given interface xml file and add it to -# the list of sources +# the list of sources. +# +# You can pass additional parameters to the qdbusxml2cpp call by setting +# properties on the input file: +# +# INCLUDE the given file will be included in the generate interface header +# +# CLASSNAME the generated class is named accordingly +# +# NO_NAMESPACE the generated class is not wrapped in a namespace # # macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... ) -# create the interface header and implementation files -# for all listed interface xml files -# the name will be automatically determined from the name of the xml file +# Create the interface header and implementation files +# for all listed interface xml files. +# The basename will be automatically determined from the name of the xml file. +# +# The source file properties described for QT4_ADD_DBUS_INTERFACE also apply here. # # macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] [classname]) # create a dbus adaptor (header and implementation file) from the xml file @@ -217,7 +230,7 @@ # QT_QAXCONTAINER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) # QT_QAXSERVER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) # QT_QTCORE_INCLUDE_DIR Path to "include/QtCore" -# QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus" +# QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus" # QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner" # QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR Path to "include/QtDesigner" # QT_QTGUI_INCLUDE_DIR Path to "include/QtGui" diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index f867bc51a1..68f3c8085d 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -220,9 +220,9 @@ ENDMACRO (QT4_ADD_RESOURCES) MACRO(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) GET_FILENAME_COMPONENT(_infile ${_interface} ABSOLUTE) - SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) - SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) - SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc) + SET(_header "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h") + SET(_impl "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp") + SET(_moc "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc") GET_SOURCE_FILE_PROPERTY(_nonamespace ${_interface} NO_NAMESPACE) IF(_nonamespace) @@ -241,16 +241,16 @@ MACRO(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) SET(_params ${_params} -i ${_include}) ENDIF(_include) - ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} + ADD_CUSTOM_COMMAND(OUTPUT "${_impl}" "${_header}" COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} ${_params} -p ${_basename} ${_infile} DEPENDS ${_infile} VERBATIM) - SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE) + SET_SOURCE_FILES_PROPERTIES("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) - QT4_GENERATE_MOC(${_header} ${_moc}) + QT4_GENERATE_MOC("${_header}" "${_moc}") - SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc}) - MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc}) + LIST(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}") + MACRO_ADD_FILE_DEPENDENCIES("${_impl}" "${_moc}") ENDMACRO(QT4_ADD_DBUS_INTERFACE) @@ -258,9 +258,10 @@ ENDMACRO(QT4_ADD_DBUS_INTERFACE) MACRO(QT4_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}) QT4_ADD_DBUS_INTERFACE(${_sources} ${_infile} ${_basename}interface) ENDFOREACH (_current_FILE) ENDMACRO(QT4_ADD_DBUS_INTERFACES) @@ -305,27 +306,27 @@ MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optional ENDIF (_optionalBasename) SET(_optionalClassName "${ARGV5}") - SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) - SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) - SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc) + SET(_header "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h") + SET(_impl "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp") + SET(_moc "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc") IF(_optionalClassName) - ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} + ADD_CUSTOM_COMMAND(OUTPUT "${_impl}" "${_header}" COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile} DEPENDS ${_infile} VERBATIM ) ELSE(_optionalClassName) - ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} + ADD_CUSTOM_COMMAND(OUTPUT "${_impl}" "${_header}" COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile} DEPENDS ${_infile} VERBATIM ) ENDIF(_optionalClassName) - QT4_GENERATE_MOC(${_header} ${_moc}) - SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE) - MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc}) + QT4_GENERATE_MOC("${_header}" "${_moc}") + SET_SOURCE_FILES_PROPERTIES("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) + MACRO_ADD_FILE_DEPENDENCIES("${_impl}" "${_moc}") - SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc}) + LIST(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}") ENDMACRO(QT4_ADD_DBUS_ADAPTOR) |