From e96683b048e1d710b1bb0791b816638207283ef0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 24 Jan 2014 13:00:48 +0100 Subject: [PATCH] Qt4: Use IMPORTED executable names with custom commands. Finding Qt 5 can overwrite the QT_MOC_EXECUTABLE variable with the moc from Qt 5. Use the IMPORTED target with the explicit version in the name to avoid that. --- Modules/Qt4Macros.cmake | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index fd9819f81..df2318b91 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -140,7 +140,7 @@ macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target) set(_moc_extra_parameters_file @${_moc_parameters_file}) add_custom_command(OUTPUT ${outfile} - COMMAND ${QT_MOC_EXECUTABLE} ${_moc_extra_parameters_file} + COMMAND Qt4::moc ${_moc_extra_parameters_file} DEPENDS ${infile} ${_moc_working_dir} VERBATIM) @@ -191,7 +191,7 @@ macro (QT4_WRAP_UI outfiles ) get_filename_component(infile ${it} ABSOLUTE) set(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) add_custom_command(OUTPUT ${outfile} - COMMAND ${QT_UIC_EXECUTABLE} + COMMAND Qt4::uic ARGS ${ui_options} -o ${outfile} ${infile} MAIN_DEPENDENCY ${infile} VERBATIM) set(${outfiles} ${${outfiles}} ${outfile}) @@ -238,7 +238,7 @@ macro (QT4_ADD_RESOURCES outfiles ) endif() add_custom_command(OUTPUT ${outfile} - COMMAND ${QT_RCC_EXECUTABLE} + COMMAND Qt4::rcc ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile} MAIN_DEPENDENCY ${infile} DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM) @@ -272,7 +272,7 @@ macro(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) endif() add_custom_command(OUTPUT "${_impl}" "${_header}" - COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} ${_params} -p ${_basename} ${_infile} + COMMAND Qt4::qdbusxml2cpp ${_params} -p ${_basename} ${_infile} DEPENDS ${_infile} VERBATIM) set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) @@ -318,7 +318,7 @@ macro(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options endif () add_custom_command(OUTPUT ${_target} - COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_qt4_dbus_options} ${_in_file} -o ${_target} + COMMAND Qt4::qdbuscpp2xml ${_qt4_dbus_options} ${_in_file} -o ${_target} DEPENDS ${_in_file} VERBATIM ) endmacro() @@ -342,12 +342,12 @@ macro(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optional if(_optionalClassName) add_custom_command(OUTPUT "${_impl}" "${_header}" - COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile} + COMMAND Qt4::qdbuscpp2xml -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile} DEPENDS ${_infile} VERBATIM ) else() add_custom_command(OUTPUT "${_impl}" "${_header}" - COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile} + COMMAND Qt4::qdbusxml2cpp -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile} DEPENDS ${_infile} VERBATIM ) endif() @@ -445,7 +445,7 @@ macro(QT4_CREATE_TRANSLATION _qm_files) file(WRITE ${_ts_pro} "SOURCES =${_pro_srcs}\nINCLUDEPATH =${_pro_includes}\n") endif() add_custom_command(OUTPUT ${_ts_file} - COMMAND ${QT_LUPDATE_EXECUTABLE} + COMMAND Qt4::lupdate ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file} DEPENDS ${_my_sources} ${_ts_pro} VERBATIM) endforeach() @@ -466,7 +466,7 @@ macro(QT4_ADD_TRANSLATION _qm_files) endif() add_custom_command(OUTPUT ${qm} - COMMAND ${QT_LRELEASE_EXECUTABLE} + COMMAND Qt4::lrelease ARGS ${_abs_FILE} -qm ${qm} DEPENDS ${_abs_FILE} VERBATIM )