Merge topic 'Qt4Macros-generated-resources'
9ce67d3 Qt4Macros: Added support for generated resource files
This commit is contained in:
commit
8d8e5a9626
@ -182,23 +182,31 @@ MACRO (QT4_ADD_RESOURCES outfiles )
|
|||||||
GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
|
GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
|
||||||
GET_FILENAME_COMPONENT(rc_path ${infile} PATH)
|
GET_FILENAME_COMPONENT(rc_path ${infile} PATH)
|
||||||
SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx)
|
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)
|
SET(_RC_DEPENDS)
|
||||||
FOREACH(_RC_FILE ${_RC_FILES})
|
IF(EXISTS "${infile}")
|
||||||
STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}")
|
# parse file for dependencies
|
||||||
IF(NOT IS_ABSOLUTE "${_RC_FILE}")
|
# all files are absolute paths or relative to the location of the qrc file
|
||||||
SET(_RC_FILE "${rc_path}/${_RC_FILE}")
|
FILE(READ "${infile}" _RC_FILE_CONTENTS)
|
||||||
ENDIF(NOT IS_ABSOLUTE "${_RC_FILE}")
|
STRING(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}")
|
||||||
SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}")
|
FOREACH(_RC_FILE ${_RC_FILES})
|
||||||
ENDFOREACH(_RC_FILE)
|
STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}")
|
||||||
# Since this cmake macro is doing the dependency scanning for these files,
|
IF(NOT IS_ABSOLUTE "${_RC_FILE}")
|
||||||
# let's make a configured file and add it as a dependency so cmake is run
|
SET(_RC_FILE "${rc_path}/${_RC_FILE}")
|
||||||
# again when dependencies need to be recomputed.
|
ENDIF(NOT IS_ABSOLUTE "${_RC_FILE}")
|
||||||
QT4_MAKE_OUTPUT_FILE("${infile}" "" "qrc.depends" out_depends)
|
SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}")
|
||||||
CONFIGURE_FILE("${infile}" "${out_depends}" COPY_ONLY)
|
ENDFOREACH(_RC_FILE)
|
||||||
|
# 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.
|
||||||
|
QT4_MAKE_OUTPUT_FILE("${infile}" "" "qrc.depends" out_depends)
|
||||||
|
CONFIGURE_FILE("${infile}" "${out_depends}" COPY_ONLY)
|
||||||
|
ELSE(EXISTS "${infile}")
|
||||||
|
# The .qrc file does not exist (yet). Let's add a dependency and hope
|
||||||
|
# that it will be generated later
|
||||||
|
SET(out_depends)
|
||||||
|
ENDIF(EXISTS "${infile}")
|
||||||
|
|
||||||
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
|
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
|
||||||
COMMAND ${QT_RCC_EXECUTABLE}
|
COMMAND ${QT_RCC_EXECUTABLE}
|
||||||
ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile}
|
ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user