2 # Accepts a variable holding the source files
3 # and creates source groups (for VS, Xcode etc)
4 # that replicate the folder hierarchy on disk
5 macro( create_source_groups source_files_variable )
6 foreach( source_file ${${source_files_variable}} )
7 string( REGEX REPLACE ${CMAKE_CURRENT_SOURCE_DIR} "" relative_directory "${source_file}")
8 string( REGEX REPLACE "[\\\\/][^\\\\/]*$" "" relative_directory "${relative_directory}")
9 string( REGEX REPLACE "^[\\\\/]" "" relative_directory "${relative_directory}")
12 string( REGEX REPLACE "/" "\\\\" relative_directory "${relative_directory}" )
15 source_group( "${relative_directory}" FILES ${source_file} )