From ddf5226bd7e120a5ef6fdf5fb82be36a48844cb7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 19 Jun 2012 17:09:23 +0200 Subject: Forward-port change to QT4_ADD_RESOURCES macro for missing rcc files. Forward-port of commit 9ce67d30011db4528d3d0bbee36412e13cfb80cc in cmake.git. Change-Id: I2d6c14f68f1630fc0835b3103e5058f52c2d0d13 Reviewed-by: David Faure --- src/corelib/Qt5CoreMacros.cmake | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'src/corelib/Qt5CoreMacros.cmake') diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index cbd141aeb3..9d5f85a441 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -176,23 +176,31 @@ function(QT5_ADD_RESOURCES outfiles ) get_filename_component(infile ${it} ABSOLUTE) get_filename_component(rc_path ${infile} PATH) set(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx) - # parse file for dependencies - # all files are absolute paths or relative to the location of the qrc file - file(READ "${infile}" _RC_FILE_CONTENTS) - string(REGEX MATCHALL "]*>" "" _RC_FILE "${_RC_FILE}") - if(NOT IS_ABSOLUTE "${_RC_FILE}") - set(_RC_FILE "${rc_path}/${_RC_FILE}") - endif() - set(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") - endforeach() - # Since this cmake function is doing the dependency scanning for these files, - # let's make a configured file and add it as a dependency so cmake is run - # again when dependencies need to be recomputed. - qt5_make_output_file("${infile}" "" "qrc.depends" out_depends) - configure_file("${infile}" "${out_depends}" COPY_ONLY) + if(EXISTS "${infile}") + # parse file for dependencies + # all files are absolute paths or relative to the location of the qrc file + file(READ "${infile}" _RC_FILE_CONTENTS) + string(REGEX MATCHALL "]*>" "" _RC_FILE "${_RC_FILE}") + if(NOT IS_ABSOLUTE "${_RC_FILE}") + set(_RC_FILE "${rc_path}/${_RC_FILE}") + endif() + set(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") + endforeach() + # Since this cmake macro is doing the dependency scanning for these files, + # let's make a configured file and add it as a dependency so cmake is run + # again when dependencies need to be recomputed. + qt5_make_output_file("${infile}" "" "qrc.depends" out_depends) + configure_file("${infile}" "${out_depends}" COPY_ONLY) + else() + # The .qrc file does not exist (yet). Let's add a dependency and hope + # that it will be generated later + set(out_depends) + endif() + add_custom_command(OUTPUT ${outfile} COMMAND ${QT_RCC_EXECUTABLE} ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile} -- cgit v1.2.3