1 #-------------------------------------------------------------------------------
2 # ______ ______ ____ __ __
3 # | ____| | ____/ __ \ /\ | \/ |
4 # | |__ _ __ ___ ___| |__ | | | | / \ | \ / |
5 # | __| '__/ _ \/ _ \ __|| | | |/ /\ \ | |\/| |
6 # | | | | | __/ __/ | | |__| / ____ \| | | |
7 # |_| |_| \___|\___|_| \____/_/ \_\_| |_|
9 # FreeFOAM: The Cross-Platform CFD Toolkit
11 # Copyright (C) 2008 Michael Wild <themiwi@users.sf.net>
12 # Gerber van der Graaf <gerber_graaf@users.sf.net>
13 #-------------------------------------------------------------------------------
15 # This file is part of FreeFOAM.
17 # FreeFOAM is free software; you can redistribute it and/or modify it
18 # under the terms of the GNU General Public License as published by the
19 # Free Software Foundation; either version 2 of the License, or (at your
20 # option) any later version.
22 # FreeFOAM is distributed in the hope that it will be useful, but WITHOUT
23 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 # You should have received a copy of the GNU General Public License
28 # along with FreeFOAM; if not, write to the Free Software Foundation,
29 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #-------------------------------------------------------------------------------
32 # - Configure utility scripts for build and install tree
34 # CONFIGURE_SCRIPTS( destDir [script1 ...] [COPYONLY scriptn1 ...] )
36 # Configures all scripts passed into
37 # - ${CMAKE_BINARY_DIR}/${destDir}/ using build tree settings
38 # - ${CMAKE_BINARY_DIR}/InstallFiles/${destDir}/ using install tree settings
39 # using CONFIGURE_FILE with @ONLY. If a .in suffix is present, it will be removed.
41 # Scripts after the COPYONLY are not configured.
43 # Variables which are adjusted to the different trees:
45 # - build tree: ${CMAKE_SOURCE_DIR}/data
46 # - install tree: ${FF_INSTALL_DATA_PATH}
48 macro( CONFIGURE_SCRIPTS _destDir )
52 if( _s STREQUAL COPYONLY )
54 else( _s STREQUAL COPYONLY )
56 get_filename_component( _cs ${_s} NAME )
57 get_filename_component( _cp ${_s} PATH )
58 string( REGEX REPLACE "\\.in$" "" _cs "${_cp}/${EXECUTABLE_PREFIX}${_cs}" )
59 # configure the script for build tree
60 set( FF_DATA_DIR ${CMAKE_SOURCE_DIR}/data )
61 configure_file( ${_s} ${CMAKE_BINARY_DIR}/${_destDir}/${_cs} ${_mode} )
62 # configure the script for install tree
63 set( FF_DATA_DIR ${FF_INSTALL_DATA_PATH} )
64 configure_file( ${_s} ${CMAKE_BINARY_DIR}/InstallFiles/${_destDir}/${_cs} ${_mode} )
65 endif( _s STREQUAL COPYONLY )
67 endmacro( CONFIGURE_SCRIPTS )
69 # ------------------------- vim: set sw=2 sts=2 et: --------------- end-of-file