1 #-------------------------------------------------------------------------------
2 # ______ ______ ____ __ __
3 # | ____| | ____/ __ \ /\ | \/ |
4 # | |__ _ __ ___ ___| |__ | | | | / \ | \ / |
5 # | __| '__/ _ \/ _ \ __|| | | |/ /\ \ | |\/| |
6 # | | | | | __/ __/ | | |__| / ____ \| | | |
7 # |_| |_| \___|\___|_| \____/_/ \_\_| |_|
9 # FreeFOAM: The Cross-Platform CFD Toolkit
11 # Copyright (C) 2008-2009 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
32 # Common CMake include file which contains boiler-plate code to compile a
33 # FreeFOAM application. It is only intended for internal use.
35 # To compile a FreeFOAM application, simply set the variables APP_NAME and
36 # APP_LIBS and create a file called files.cmake in the source directory which
37 # defines the variable SRCS, containing a list of all source files. Note that
38 # the first source file is expected to be the "main" source file, containing
39 # a documentation header. The list can also contain flex++ source files (with
40 # the extension .L). Below code will find it, add an appropriate flex-target
41 # and replace the .L file in the SRCS list by the generated .C file.
43 # Installation, addition to the doc index and the creation of the man-page
44 # are all handled here too.
45 #-------------------------------------------------------------------------------
47 include( ${CMAKE_CURRENT_SOURCE_DIR}/files.cmake )
49 set( TARGET_NAME freefoam-${APP_NAME} )
50 list( GET SRCS 0 MAIN_SRC )
52 # check for .L sources
53 foam_check_and_compile_flex( SRCS )
55 add_executable( ${TARGET_NAME} ${SRCS} )
57 target_link_libraries( ${TARGET_NAME} ${APP_LIBS} )
59 install( TARGETS ${TARGET_NAME}
60 LIBRARY DESTINATION ${FOAM_INSTALL_LIBRARY_PATH} COMPONENT bin
61 ARCHIVE DESTINATION ${FOAM_INSTALL_LIBRARY_PATH} COMPONENT bin
62 RUNTIME DESTINATION ${FOAM_INSTALL_LIBEXEC_PATH} COMPONENT bin
65 foam_add_executable_to_doc_index( ${TARGET_NAME} ${MAIN_SRC} )
66 foam_create_manpage( ${TARGET_NAME} ${MAIN_SRC} )
68 # ------------------------- vim: set sw=2 sts=2 et: --------------- end-of-file