Commit 649a8f2d authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Function added to the CMakeLists.txt file that parses Qt resource files (.qrc)...

Function added to the CMakeLists.txt file that parses Qt resource files (.qrc) and adds all files referenced by them to the VisualStudio project, into a folder entitled "Resource files".
parent 36de7f49
......@@ -3,6 +3,24 @@ message( STATUS "Creating solution " ${UI_EXEC_TARGET} )
project( ${UI_EXEC_TARGET} )
function( generate_resource_solution_folders qtResourceFiles allResourceFiles )
if( ENABLE_SOLUTION_FOLDERS )
set( ALL_RESOURCE_FILES "" )
foreach( QRC_FILE IN ITEMS ${qtResourceFiles} )
file( READ ${QRC_FILE} QRC_FILE_CONTENT )
string( REGEX MATCHALL "<file[^>]*>[^<]+</file>" QRC_FILE_TAGS ${QRC_FILE_CONTENT} )
string( REGEX REPLACE "<file[^>]*>([^<]+)</file>" "./\\1;" RESOURCES ${QRC_FILE_TAGS} )
foreach( R IN ITEMS ${RESOURCES} )
string( REGEX REPLACE "\\./(([^/]+/)*).+" "\\1" SUBDIR ${R} )
string( REPLACE "/" "\\" SUBDIR ${SUBDIR} )
source_group( "Resource Files\\${SUBDIR}" FILES ${R} )
endforeach()
set( ${allResourceFiles} "${${allResourceFiles}};${RESOURCES}" PARENT_SCOPE )
endforeach()
endif()
endfunction( generate_resource_solution_folders )
# Detect platform.
if( WIN32 )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment