File: FileSystemSourceGroups.cmake

package info (click to toggle)
flightcrew 0.9.3+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 6,748 kB
  • sloc: cpp: 53,736; xml: 2,006; ansic: 275; python: 215; sh: 112; makefile: 8; exp: 8
file content (17 lines) | stat: -rw-r--r-- 711 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# Accepts a variable holding the source files
# and creates source groups (for VS, Xcode etc)
# that replicate the folder hierarchy on disk
macro( create_source_groups source_files_variable )
	foreach( source_file ${${source_files_variable}} )
		string( REGEX REPLACE ${CMAKE_CURRENT_SOURCE_DIR} "" relative_directory "${source_file}")
		string( REGEX REPLACE "[\\\\/][^\\\\/]*$" "" relative_directory "${relative_directory}")
		string( REGEX REPLACE "^[\\\\/]" "" relative_directory "${relative_directory}")

		if( WIN32 )
			string( REGEX REPLACE "/" "\\\\" relative_directory "${relative_directory}" )
		endif( WIN32 )

		source_group( "${relative_directory}" FILES ${source_file} )
	endforeach()
endmacro()