cvmake.sh

Panos Georgiadis, 2012-12-27 02:37 am

Download (653 Bytes)

 
1
#!/bin/bash
2
3
app=`echo $1 | awk -F "." '{ print $1 }'`;
4
5
if [ -f CMakeLists.txt ]
6
then
7
    mv CMakeLists.txt CMakeLists.txt.old
8
    echo Old CMakeLists.txt has renamed as CMakeLists.txt.old
9
    rm CMakeLists.txt
10
fi
11
    touch CMakeLists.txt
12
    echo -e "cmake_minimum_required(VERSION 2.6)" >> CMakeLists.txt
13
    echo -e "project( $app )" >> CMakeLists.txt
14
    echo -e "find_package( OpenCV REQUIRED )" >> CMakeLists.txt
15
    echo -e "add_executable( $app $app.cpp )" >> CMakeLists.txt
16
    echo -e "target_link_libraries( $app \${OpenCV_LIBS} )" >> CMakeLists.txt
17
echo CMakeLists.txt has been created!
18
mkdir build
19
cd build
20
cmake ..
21
make
22
cp $app ..
23
cd ..
24