share/hedgewars/Data/Music/CMakeLists.txt
author unc0rr
Sun, 03 Feb 2008 17:02:20 +0000
changeset 782 e2d2b84aa776
parent 564 17fb45c670c1
child 1097 06b15817b8a0
permissions -rw-r--r--
Full support for out-of-source build

file(GLOB BaseMusic *.ogg) 

list(LENGTH BaseMusic PlayListLength)

set(PlayListINCFile ${CMAKE_BINARY_DIR}/hedgewars/playlist.inc)

file(WRITE ${PlayListINCFile} "const cPlayListLength = " ${PlayListLength} ";")

if(PlayListLength GREATER 0)
	file(APPEND ${PlayListINCFile} "{$DEFINE HAVE_MUSIC}")
	file(APPEND ${PlayListINCFile} "playlist: array[0..Pred(cPlayListLength)] of string = (")
	
	set(i ${PlayListLength})
	foreach(musicfile ${BaseMusic})
		math(EXPR i "${i} - 1")
		
		get_filename_component(relfilename ${musicfile} NAME)
		
		file(APPEND ${PlayListINCFile} '${relfilename}')
		
		if(i GREATER 0)
			file(APPEND ${PlayListINCFile} ",")
		endif(i GREATER 0)
	endforeach(musicfile)
	
	file(APPEND ${PlayListINCFile} ");")
	
	file(APPEND ${PlayListINCFile} "var playlistchain: array[0..Pred(cPlayListLength)] of LongWord;")
endif(PlayListLength GREATER 0)

install(FILES
	${BaseMusic}
	DESTINATION ${SHAREPATH}Data/Music)