ENH: Rename CMake variables and files
[freefoam.git] / data / utilities / createCMakeFiles
blob31bcea94327d14f440084b1a3f1ea6c952756302
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 # \\/ M anipulation |
8 #-------------------------------------------------------------------------------
9 # License
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software; you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by the
14 # Free Software Foundation; either version 2 of the License, or (at your
15 # option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 # for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM; if not, write to the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 # Script
27 # makeCMakeFiles
29 # Description
30 # Scan the current directory for source files and construct CMakeLists.txt
31 # and files.cmake
33 # Usage : makeCMakeFiles
35 #------------------------------------------------------------------------------
37 Script=${0##*/}
39 if [ -r files.cmake ]
40 then
41 echo "$Script: files.cmake already exists, exiting"
42 exit 1
45 if [ -r CMakeLists.txt ]
46 then
47 echo "$Script: CMakeLists.txt already exists, exiting"
48 exit 1
51 # all sources
52 srcs=(`find . -iname "*.C" -type f -print | sed 's|^\./||' | tr "\n" " "`)
53 echo "srcs=$srcs"
55 # the name of the application
56 exe_name=`basename $PWD`
57 echo "exe_name=$exe_name"
59 # configure the files.cmake
60 cat > files.cmake << _EOF_
61 #-------------------------------------------------------------------------------
62 # ______ ______ ____ __ __
63 # | ____| | ____/ __ \ /\ | \/ |
64 # | |__ _ __ ___ ___| |__ | | | | / \ | \ / |
65 # | __| '__/ _ \/ _ \ __|| | | |/ /\ \ | |\/| |
66 # | | | | | __/ __/ | | |__| / ____ \| | | |
67 # |_| |_| \___|\___|_| \____/_/ \_\_| |_|
69 # FreeFOAM: The Cross-Platform CFD Toolkit
71 # Copyright (C) 2008-2009 Michael Wild <themiwi@users.sf.net>
72 # Gerber van der Graaf <gerber_graaf@users.sf.net>
73 #-------------------------------------------------------------------------------
74 # License
75 # This file is part of FreeFOAM.
77 # FreeFOAM is free software; you can redistribute it and/or modify it
78 # under the terms of the GNU General Public License as published by the
79 # Free Software Foundation; either version 2 of the License, or (at your
80 # option) any later version.
82 # FreeFOAM is distributed in the hope that it will be useful, but WITHOUT
83 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
84 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
85 # for more details.
87 # You should have received a copy of the GNU General Public License
88 # along with FreeFOAM; if not, write to the Free Software Foundation,
89 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
90 #-------------------------------------------------------------------------------
92 set( SRCS
93 `printf " %s\n" $srcs`
96 # ------------------------- vim: set sw=2 sts=2 et: --------------- end-of-file
97 _EOF_
99 # configure CMakeLists.txt
100 cat > CMakeLists.txt << _EOF_
101 #-------------------------------------------------------------------------------
102 # ______ ______ ____ __ __
103 # | ____| | ____/ __ \ /\ | \/ |
104 # | |__ _ __ ___ ___| |__ | | | | / \ | \ / |
105 # | __| '__/ _ \/ _ \ __|| | | |/ /\ \ | |\/| |
106 # | | | | | __/ __/ | | |__| / ____ \| | | |
107 # |_| |_| \___|\___|_| \____/_/ \_\_| |_|
109 # FreeFOAM: The Cross-Platform CFD Toolkit
111 # Copyright (C) 2008-2009 Michael Wild <themiwi@users.sf.net>
112 # Gerber van der Graaf <gerber_graaf@users.sf.net>
113 #-------------------------------------------------------------------------------
114 # License
115 # This file is part of FreeFOAM.
117 # FreeFOAM is free software; you can redistribute it and/or modify it
118 # under the terms of the GNU General Public License as published by the
119 # Free Software Foundation; either version 2 of the License, or (at your
120 # option) any later version.
122 # FreeFOAM is distributed in the hope that it will be useful, but WITHOUT
123 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
124 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
125 # for more details.
127 # You should have received a copy of the GNU General Public License
128 # along with FreeFOAM; if not, write to the Free Software Foundation,
129 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
130 #-------------------------------------------------------------------------------
132 find_package( FreeFOAM REQUIRED )
134 include( \${FreeFOAM_USE_FILE} )
136 include( files.cmake )
138 add_executable( $exe_name \${SRCS} )
140 target_link_libraries( $exe_name
141 FOAM_OpenFOAM
142 FOAM_finiteVolume
145 # ------------------------- vim: set sw=2 sts=2 et: --------------- end-of-file
146 _EOF_
148 # ------------------------- vim: set sw=3 sts=3 et: --------------- end-of-file