diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-06-19 17:09:23 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-23 11:37:39 +0200 |
commit | ddf5226bd7e120a5ef6fdf5fb82be36a48844cb7 (patch) | |
tree | afa470dd9161255d51680a8542710417534456be /src | |
parent | 9a16e146663210a4b7cdedc9b2a3dcd57cb1cbec (diff) |
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 <faure@kde.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/Qt5CoreMacros.cmake | 40 |
1 files changed, 24 insertions, 16 deletions
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 "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}") + set(_RC_DEPENDS) - foreach(_RC_FILE ${_RC_FILES}) - string(REGEX REPLACE "^<file[^>]*>" "" _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 "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}") + foreach(_RC_FILE ${_RC_FILES}) + string(REGEX REPLACE "^<file[^>]*>" "" _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} |