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.
This commit is contained in:
Stephen Kelly 2014-01-24 13:00:48 +01:00
parent e6182f5d5d
commit e96683b048
1 changed files with 9 additions and 9 deletions

View File

@ -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}) set(_moc_extra_parameters_file @${_moc_parameters_file})
add_custom_command(OUTPUT ${outfile} add_custom_command(OUTPUT ${outfile}
COMMAND ${QT_MOC_EXECUTABLE} ${_moc_extra_parameters_file} COMMAND Qt4::moc ${_moc_extra_parameters_file}
DEPENDS ${infile} DEPENDS ${infile}
${_moc_working_dir} ${_moc_working_dir}
VERBATIM) VERBATIM)
@ -191,7 +191,7 @@ macro (QT4_WRAP_UI outfiles )
get_filename_component(infile ${it} ABSOLUTE) get_filename_component(infile ${it} ABSOLUTE)
set(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) set(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
add_custom_command(OUTPUT ${outfile} add_custom_command(OUTPUT ${outfile}
COMMAND ${QT_UIC_EXECUTABLE} COMMAND Qt4::uic
ARGS ${ui_options} -o ${outfile} ${infile} ARGS ${ui_options} -o ${outfile} ${infile}
MAIN_DEPENDENCY ${infile} VERBATIM) MAIN_DEPENDENCY ${infile} VERBATIM)
set(${outfiles} ${${outfiles}} ${outfile}) set(${outfiles} ${${outfiles}} ${outfile})
@ -238,7 +238,7 @@ macro (QT4_ADD_RESOURCES outfiles )
endif() endif()
add_custom_command(OUTPUT ${outfile} add_custom_command(OUTPUT ${outfile}
COMMAND ${QT_RCC_EXECUTABLE} COMMAND Qt4::rcc
ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile} ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile}
MAIN_DEPENDENCY ${infile} MAIN_DEPENDENCY ${infile}
DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM) DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM)
@ -272,7 +272,7 @@ macro(QT4_ADD_DBUS_INTERFACE _sources _interface _basename)
endif() endif()
add_custom_command(OUTPUT "${_impl}" "${_header}" add_custom_command(OUTPUT "${_impl}" "${_header}"
COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} ${_params} -p ${_basename} ${_infile} COMMAND Qt4::qdbusxml2cpp ${_params} -p ${_basename} ${_infile}
DEPENDS ${_infile} VERBATIM) DEPENDS ${_infile} VERBATIM)
set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE)
@ -318,7 +318,7 @@ macro(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options
endif () endif ()
add_custom_command(OUTPUT ${_target} 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 DEPENDS ${_in_file} VERBATIM
) )
endmacro() endmacro()
@ -342,12 +342,12 @@ macro(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optional
if(_optionalClassName) 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} COMMAND Qt4::qdbuscpp2xml -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile}
DEPENDS ${_infile} VERBATIM DEPENDS ${_infile} VERBATIM
) )
else() else()
add_custom_command(OUTPUT "${_impl}" "${_header}" 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 DEPENDS ${_infile} VERBATIM
) )
endif() endif()
@ -445,7 +445,7 @@ macro(QT4_CREATE_TRANSLATION _qm_files)
file(WRITE ${_ts_pro} "SOURCES =${_pro_srcs}\nINCLUDEPATH =${_pro_includes}\n") file(WRITE ${_ts_pro} "SOURCES =${_pro_srcs}\nINCLUDEPATH =${_pro_includes}\n")
endif() endif()
add_custom_command(OUTPUT ${_ts_file} add_custom_command(OUTPUT ${_ts_file}
COMMAND ${QT_LUPDATE_EXECUTABLE} COMMAND Qt4::lupdate
ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file} ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file}
DEPENDS ${_my_sources} ${_ts_pro} VERBATIM) DEPENDS ${_my_sources} ${_ts_pro} VERBATIM)
endforeach() endforeach()
@ -466,7 +466,7 @@ macro(QT4_ADD_TRANSLATION _qm_files)
endif() endif()
add_custom_command(OUTPUT ${qm} add_custom_command(OUTPUT ${qm}
COMMAND ${QT_LRELEASE_EXECUTABLE} COMMAND Qt4::lrelease
ARGS ${_abs_FILE} -qm ${qm} ARGS ${_abs_FILE} -qm ${qm}
DEPENDS ${_abs_FILE} VERBATIM DEPENDS ${_abs_FILE} VERBATIM
) )