I want to write a qmake file to compile all .cpp files in a working directory.

It should also create a .so library for each file.

Is this possible?

I can do this easily with a simple script:

#read all files in the current directory
files=*.cpp

#loop over files content
for file in $files;
do
name=${file%.*}
if [ ! -f $1 ]; then
echo "The file $1 does not exist."
exit
else

#compile the new library
g++ -fPIC -c $name.cpp -o $name.o -lgsl -lgslcblas
g++ -shared -Wl,-soname,lib$name.so -o lib$name.so $name.o -lgsl -lgslcblas

fi
fi
exit 0