buildsystem/cmake: Add an embryonary CMake support. Files are constrained into the...
[vlc.git] / extras / buildsystem / cmake / scripts / convert_modules_to_cmake.sh
1 #!/bin/sh
2 echo "Searching $1"
3 for file in `find $1 -name "Modules.am"`; do
4      cmake_file=`dirname $file`/CMakeLists.txt
5      echo "Creating $cmake_file"
6      cat $file | perl -ne 's/\\\n/ /g; print' | sed -n -e "s/^SOURCES_\(.*\)[ ]*=\(.*\)$/vlc_add_module( \1 \2 )/p" | tr '\t' ' '  | sed 's/  */ /g'  | sed 's/\$(NULL)//g' > $cmake_file
7      dir=`dirname $file`
8      echo "" >> $cmake_file
9      for subdirfile in `find $dir -name "Modules.am"`; do
10         if [ "$subdirfile" != "$file" ]; then
11           subdir=`echo \`dirname $subdirfile\` | sed -e "s:$dir::" | sed -e "s:^/::"`
12           echo "add_subdirectory( $subdir )" >> $cmake_file
13         fi
14      done
15 done