FIX: Forgot to remove wmake stuff from twoPhaseInterfaceProperties
[freefoam.git] / CMakeLists.txt
blob9b414dd610bd0e4a5934a56a6c4b9815e9b8f510
1 #-------------------------------------------------------------------------------
2 #               ______                _     ____          __  __
3 #              |  ____|             _| |_  / __ \   /\   |  \/  |
4 #              | |__ _ __ ___  ___ /     \| |  | | /  \  | \  / |
5 #              |  __| '__/ _ \/ _ ( (| |) ) |  | |/ /\ \ | |\/| |
6 #              | |  | | |  __/  __/\_   _/| |__| / ____ \| |  | |
7 #              |_|  |_|  \___|\___|  |_|   \____/_/    \_\_|  |_|
9 #                   FreeFOAM: The Cross-Platform CFD Toolkit
11 # Copyright (C) 2008-2010 Michael Wild <themiwi@users.sf.net>
12 #                         Gerber van der Graaf <gerber_graaf@users.sf.net>
13 #-------------------------------------------------------------------------------
14 # License
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
25 #   for more details.
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 cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
34 project(FreeFOAM)
36 string(TOLOWER "${PROJECT_NAME}" LOWER_PROJECT_NAME)
38 # version information
39 set(FOAM_VERSION_MAJOR 0)
40 set(FOAM_VERSION_MINOR 1)
41 set(FOAM_VERSION_PATCH 0)
42 set(FOAM_VERSION ${FOAM_VERSION_MAJOR}.${FOAM_VERSION_MINOR})
43 set(FOAM_VERSION_FULL ${FOAM_VERSION}.${FOAM_VERSION_PATCH})
45 # set up custom cmake module path
46 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
48 # utilities
49 set(FOAM_CREATE_INCLUDE_WRAPPERS TRUE)
50 set(FOAM_HAS_FLEX_SOURCES TRUE)
51 set(FOAM_ENABLE_DOC_INDEX TRUE)
52 set(FOAM_EXPORT_NAMESPACE FOAM_)
53 include(${CMAKE_SOURCE_DIR}/CMake/FOAMUtilities.cmake)
54 include(${CMAKE_SOURCE_DIR}/CMake/FOAMThirdPartyUtilities.cmake)
55 include(${CMAKE_SOURCE_DIR}/CMake/FOAMInternal.cmake)
56 include(CTest)
58 # determine computer system
59 include(${CMAKE_SOURCE_DIR}/CMake/FOAMDetermineArch.cmake)
61 # select precision
62 foam_option(FOAM_DOUBLE_PRECISION "Double precision"
63   "Compile ${PROJECT_NAME} with double precision floating point arithmetics." ON)
64 if(FOAM_DOUBLE_PRECISION)
65   set(FOAM_PRECISION DP)
66 else()
67   set(FOAM_PRECISION SP)
68 endif()
70 # select whether we want to build framewors on Mac OS X
71 if(APPLE)
72   foam_option(FOAM_BUILD_FRAMEWORKS "Build frameworks"
73     "Build frameworks on Mac OS X" OFF)
74 else()
75   set(FOAM_BUILD_FRAMEWORKS OFF)
76 endif()
78 # find python interpreter
79 find_package(PythonInterp REQUIRED)
81 # make sure we got Python version 2.6 or newer
82 foam_dependent_variables(PYTHON_EXECUTABLE PYTHON_VERSION)
83 if(NOT PYTHON_VERSION)
84   execute_process(
85     COMMAND ${PYTHON_EXECUTABLE} -c
86     "import sys; sys.stdout.write('%s.%s.%s\\n'%sys.version_info[0:3])"
87     RESULT_VARIABLE _py_version_result
88     OUTPUT_VARIABLE _py_version_output
89     ERROR_VARIABLE _py_version_output
90     OUTPUT_STRIP_TRAILING_WHITESPACE
91     )
92   if(NOT _py_version_result)
93     string(REGEX MATCH "([0-9]+\\.)+[0-9]+" PYTHON_VERSION "${_py_version_output}")
94     message(STATUS "Python version ${PYTHON_VERSION} found")
95     if(${PYTHON_VERSION} VERSION_LESS 2.4.0)
96       message(SEND_ERROR "Python version 2.4 or newer required")
97     endif()
98   else()
99     set(PYTHON_VERSION PYTHON_VERSION-NOTFOUND)
100     message(SEND_ERROR "Failed to determine the python version: ${_py_version_output}")
101   endif()
102   set(PYTHON_VERSION ${PYTHON_VERSION} CACHE INTERNAL "The Python version")
103 endif()
104 string(REGEX REPLACE "\\.[0-9]+$" "" PYTHON_SHORT_VERSION ${PYTHON_VERSION})
106 # find the installed ParaView executable
107 find_program(
108   FOAM_PARAVIEW3_APP NAMES "ParaView 3.8.1" "ParaView 3.8.0" ParaView paraview
109   DOC "Path to the ParaView 3.8 (or newer) application"
110   )
111 foam_dependent_variables(FOAM_PARAVIEW3_APP FOAM_PARAVIEW3_VERSION)
112 if(FOAM_PARAVIEW3_APP)
113   if(NOT FOAM_PARAVIEW3_VERSION)
114     execute_process(COMMAND ${FOAM_PARAVIEW3_APP} --version
115       OUTPUT_VARIABLE _pv_version_output
116       ERROR_VARIABLE _pv_version_output
117       OUTPUT_STRIP_TRAILING_WHITESPACE
118       )
119     if(_pv_version_output MATCHES "ParaView(([0-9]+\\.)+[0-9]+)")
120       set(FOAM_PARAVIEW3_VERSION ${CMAKE_MATCH_1} CACHE INTERNAL
121         "The ParaView version")
122       message(STATUS
123         "ParaView ${FOAM_PARAVIEW3_VERSION} found: ${FOAM_PARAVIEW3_APP}")
124     else()
125       message(SEND_ERROR
126         "Failed to determine the ParaView version: ${_pv_version_output}")
127     endif()
128   endif()
129   if(${FOAM_PARAVIEW3_VERSION} VERSION_LESS 3.8)
130     message(WARNING
131       "ParaView versions older than 3.8 might not be able\n"
132       "to read ${PROJECT_NAME} cases.")
133   endif()
134 else()
135   message(WARNING
136     "Failed to find the ParaView application")
137   set(FOAM_PARAVIEW3_APP)
138 endif()
140 # we want shared libraries
141 set(BUILD_SHARED_LIBS SHARED)
143 # installation directories
144 foam_installation_path(FOAM_INSTALL_BIN_PATH bin "Executables"
145   "Executables installation path")
146 if(APPLE AND FOAM_BUILD_FRAMEWORKS)
147   foam_installation_path(FOAM_INSTALL_FRAMEWORK_PATH /Library/Frameworks
148     "Frameworks" "Framework installation path")
149 endif()
150 foam_installation_path(FOAM_INSTALL_LIBRARY_PATH
151   lib/${CMAKE_PROJECT_NAME}-${FOAM_VERSION_FULL}
152   "Libraries" "Library installation path")
153 foam_installation_path(FOAM_INSTALL_LIBEXEC_PATH
154   libexec/${CMAKE_PROJECT_NAME}-${FOAM_VERSION_FULL} "Private executables"
155   "Installation path for executables not on PATH.")
156 foam_installation_path(FOAM_INSTALL_HEADER_PATH
157   include/${CMAKE_PROJECT_NAME}-${FOAM_VERSION_FULL}
158   "Headers" "Header installation path (not for frameworks)")
159 foam_installation_path(FOAM_INSTALL_CONFIG_PATH
160   etc/${CMAKE_PROJECT_NAME}/${FOAM_VERSION_FULL} "Config files"
161   "Configuration files installation path")
162 foam_installation_path(FOAM_INSTALL_DATA_PATH
163   share/${CMAKE_PROJECT_NAME}-${FOAM_VERSION_FULL} "Data files"
164   "Data files installation path")
165 foam_installation_path(FOAM_INSTALL_DOC_PATH
166   share/doc/${CMAKE_PROJECT_NAME}-${FOAM_VERSION_FULL} "Documentation"
167   "Documentation files installation path")
168 foam_installation_path(FOAM_INSTALL_MAN_PATH share/man "Man pages"
169   "Man-pages installation path")
170 foam_installation_path(FOAM_INSTALL_TUTORIALS_PATH
171   "${FOAM_INSTALL_DOC_PATH_ORIG}" "Tutorials" "Tutorials installation path")
172 foam_installation_path(FOAM_INSTALL_CMAKE_PATH
173   "${FOAM_INSTALL_DATA_PATH_ORIG}/CMake"
174   "CMake files" "CMake configuration files installation path")
175 foam_installation_path(FOAM_INSTALL_USERDFOAM_PATH
176   "${FOAM_INSTALL_LIBRARY_PATH_ORIG}/plugins/ensightReader"
177   "Ensight plugin" "Ensight OpenFOAM-reader plugin installation path")
178 foam_installation_path(FOAM_INSTALL_PYTHON_PATH
179   "lib/python${PYTHON_SHORT_VERSION}/site-packages"
180   "Python modules" "Python modules installation base path")
182 set(FOAM_INSTALL_RUNTIME_PATH "${FOAM_INSTALL_LIBEXEC_PATH}")
184 # determine the INSTALL_NAME_DIR of potential frameworks
185 if(APPLE AND FOAM_BUILD_FRAMEWORKS)
186   set(FOAM_FRAMEWORK_INSTALL_NAME_DIR "${FOAM_INSTALL_FRAMEWORK_PATH}")
187 else()
188   set(FOAM_FRAMEWORK_INSTALL_NAME_DIR "${FOAM_INSTALL_LIBRARY_PATH}")
189 endif()
191 # select html documentation browser (try a few well known ones for default)
192 # have to loop, because find_program(HTML_DOC_BROWSER NAMES ...) garbles things up
193 foreach(browser open gnome-open kde-open x-www-browser www-browser
194     firefox epiphany konqueror w3m lynx launch open)
195   find_program(HTML_DOC_BROWSER ${browser}
196     DOC "Program to open an HTML file")
197   if(HTML_DOC_BROWSER)
198     break()
199   endif()
200 endforeach()
201 if(NOT HTML_DOC_BROWSER)
202   message(STATUS
203     "Failed to find a program to open HTML pages with (a.k.a a browser).\n"
204     "Point HTML_DOC_BROWSER to a suitable program.")
205   set(HTML_DOC_BROWSER "ECHO" CACHE STRING
206     "Command to open an HTML file (ECHO will print it to STDOUT)" FORCE)
207 endif()
208 set(FOAM_HTML_DOC_BROWSER_COMMAND
209   "\${HTML_DOC_BROWSER} %f" CACHE STRING "Command to open an HTML file")
210 string(CONFIGURE "${FOAM_HTML_DOC_BROWSER_COMMAND}"
211   FOAM_HTML_DOC_BROWSER_COMMAND ESCAPE_QUOTES)
212 mark_as_advanced(HTML_DOC_BROWSER FOAM_HTML_DOC_BROWSER_COMMAND)
214 # Executable-prefix
215 string(TOLOWER "${PROJECT_NAME}-" _FOAM_DEFAULT_EXE_PREFIX)
216 set(FOAM_EXE_PREFIX "${_FOAM_DEFAULT_EXE_PREFIX}"
217   CACHE STRING "Prefix for application output-names")
218 mark_as_advanced(FOAM_EXE_PREFIX)
219 string(TOUPPER "${FOAM_EXE_PREFIX}" FOAM_UPPER_EXE_PREFIX)
221 # ask user whether she wants to build Doxygen docs
222 foam_option(FOAM_ENABLE_DOXYGEN_DOCS "Doxygen API documentation"
223   "Build the Doxygen API documentation" OFF)
224 # if user wants doxygen docs, find Doxygen and set up some options
225 if(FOAM_ENABLE_DOXYGEN_DOCS)
226   find_package(Doxygen REQUIRED)
227   foam_option(FOAM_DOXYDOCS_FOR_SF "Doxygen for SourceForge"
228     "Build the Doxygen docs for deployment on SourceForge" OFF)
229   # ask user whether she prefers local or www docs
230   foam_option(FOAM_USE_LOCAL_DOXYGEN_DOCS "Use local API docs"
231     "Use the local Doxygen documentation instead of the one on http://freefoam.sf.net/doc/Doxygen/html" OFF)
232 endif()
234 # ask user whether she wants to build the man pages
235 foam_option(FOAM_ENABLE_MANPAGE_HELP "Build manpage help"
236   "Build the manpages (requires asciidoc)" OFF)
237 # ask user whether she wants to build the xhtml man pages
238 foam_option(FOAM_ENABLE_XHTML_HELP "Build xhtml help"
239   "Build the xhtml help pages (requires asciidoc)" OFF)
241 if(BUILD_TESTING)
242   # ask user whether whe wants full tutorial tests
243   foam_option(FOAM_ENABLE_FULL_TUTORIAL_TESTS
244     "Full tutorial tests"
245     "Run the complete tutorial tests (not just a single time step)" OFF)
246 endif()
248 option(FOAM_ENABLE_CPACK "Enable CPACK packaging support" OFF)
250 # assemble the list of enabled manpage formats
251 set(FOAM_MANPAGE_FORMATS)
252 if(FOAM_ENABLE_MANPAGE_HELP)
253   list(APPEND FOAM_MANPAGE_FORMATS manpage)
254 endif()
255 if(FOAM_ENABLE_XHTML_HELP)
256   list(APPEND FOAM_MANPAGE_FORMATS xhtml)
257 endif()
259 if(FOAM_MANPAGE_FORMATS OR FOAM_ENABLE_CPACK)
260   # find AsciiDoc
261   find_program(ASCIIDOC_EXECUTABLE NAMES asciidoc.py asciidoc)
262   get_filename_component(asciidoc_path "${ASCIIDOC_EXECUTABLE}" PATH)
263   find_program(A2X_EXECUTABLE NAMES a2x.py a2x HINTS "${asciidoc_path}")
264   if(NOT ASCIIDOC_EXECUTABLE OR NOT A2X_EXECUTABLE)
265     message(SEND_ERROR "AsciiDoc is required to create man and html help")
266   endif()
267 endif()
269 # set up the RPATH for installation
270 set(CMAKE_INSTALL_RPATH ${FOAM_INSTALL_LIBRARY_PATH})
271 set(CMAKE_INSTALL_NAME_DIR ${FOAM_FRAMEWORK_INSTALL_NAME_DIR})
273 # we want executables and libraries in uniform places
274 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
275   "${CMAKE_BINARY_DIR}/libexec/${PROJECT_NAME}/${FOAM_VERSION_FULL}")
276 set(FOAM_LIBRARY_OUTPUT_DIRECTORY
277   "${CMAKE_BINARY_DIR}/lib/${PROJECT_NAME}-${FOAM_VERSION_FULL}")
278 set(FOAM_FRAMEWORK_OUTPUT_DIRECTORY
279   "${CMAKE_BINARY_DIR}/Library/Frameworks")
280 if(FOAM_BUILD_FRAMEWORKS)
281   set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${FOAM_FRAMEWORK_OUTPUT_DIRECTORY}")
282 else()
283   set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${FOAM_LIBRARY_OUTPUT_DIRECTORY}")
284 endif()
285 set(FOAM_ARCHIVE_OUTPUT_DIRECTORY "${FOAM_LIBRARY_OUTPUT_DIRECTORY}")
287 # find parallel libraries
288 find_package(MPI)
289 if(MPI_FOUND)
290   set(_FOAM_USE_MPI ON)
291 else()
292   set(_FOAM_USE_MPI OFF)
293 endif()
294 foam_option(FOAM_USE_MPI "Use MPI"
295   "Build ${CMAKE_PROJECT} against MPI parallel libraries" ${_FOAM_USE_MPI})
296 if(FOAM_USE_MPI AND NOT MPI_FOUND)
297   message(SEND_ERROR
298     "FOAM_ENABLE_MPI is true, but MPI cannot be found.\n"
299     "If you have MPI installed on your system, edit the variables\n"
300     "MPI_INCLUDE_DIR and MPI_LIBRARY in the cache, else disable the\n"
301     "setting FOAM_USE_MPI."
302   )
303 endif()
305 # find readline
306 find_package(Readline)
308 # substitution for build-tree and install-tree as used by
309 # foam_configure_files.
310 set(FOAM_CONFIGURE_FILES_VARIABLES
311   FOAM_DATA_DIR
312     "${CMAKE_BINARY_DIR}/data"
313     "${FOAM_INSTALL_DATA_PATH}"
314   FOAM_LOCAL_DOC_DIR
315     "${CMAKE_BINARY_DIR}/doc"
316     "${FOAM_INSTALL_DOC_PATH}"
317   FOAM_BIN_DIR
318     "${CMAKE_BINARY_DIR}/bin"
319     "${FOAM_INSTALL_BIN_PATH}"
320   FOAM_LIB_DIR
321     "${CMAKE_BINARY_DIR}/lib/FreeFOAM-${FOAM_VERSION_FULL}"
322     "${FOAM_INSTALL_LIBRARY_PATH}"
323   FOAM_LIBEXEC_DIR
324     "${CMAKE_BINARY_DIR}/libexec/FreeFOAM/${FOAM_VERSION_FULL}"
325     "${FOAM_INSTALL_LIBEXEC_PATH}"
326   FOAM_FRAMEWORK_DIR
327     "${CMAKE_BINARY_DIR}/Library/Frameworks"
328     "${FOAM_INSTALL_FRAMEWORK_PATH}"
329   FOAM_INCLUDE_DIR
330     "${CMAKE_BINARY_DIR}/include"
331     "${FOAM_INSTALL_HEADER_PATH}"
332   FOAM_CONFIG_DIR
333     "${CMAKE_BINARY_DIR}/etc"
334     "${FOAM_INSTALL_CONFIG_PATH}"
335   FOAM_CMAKECONFIG_DIR
336     "${CMAKE_BINARY_DIR}/CMake"
337     "${FOAM_INSTALL_CMAKE_PATH}"
338   FOAM_PYTHON_DIR
339     "${CMAKE_BINARY_DIR}/data/python"
340     "${FOAM_INSTALL_PYTHON_PATH}"
341   FOAM_IS_INSTALLED
342     "FALSE"
343     "TRUE"
344   )
345 if(FOAM_USE_LOCAL_DOXYGEN_DOCS)
346   list(APPEND FOAM_CONFIGURE_FILES_VARIABLES
347     FOAM_DOC_DIR "${CMAKE_BINARY_DIR}/doc" "${FOAM_INSTALL_DOC_PATH}")
348 else()
349   set(_sf_doc "http://freefoam.sf.net/doc/${FOAM_VERSION_FULL}")
350   list(APPEND FOAM_CONFIGURE_FILES_VARIABLES
351     FOAM_DOC_DIR "${_sf_doc}" "${_sf_doc}")
352 endif()
354 # thirdparty libraries
355 foam_thirdparty_option(Metis
356   "Required by the metis decomposition method"
357   Metis TRUE ON)
358 if(FOAM_ENABLE_METIS)
359   if(FOAM_ENABLE_METIS AND METIS_REQUIRES_MPI AND NOT FOAM_USE_MPI)
360     message(SEND_ERROR
361       "Your metis implementation requires FOAM_USE_MPI to be enabled."
362       "If you don't have/want MPI, enable FOAM_BUILD_PRIVATE_METIS instead.")
363   endif()
364 endif()
365 foam_thirdparty_option(ParMetis
366   "Required by the parmetis decomposition method"
367   ParMetis TRUE ${FOAM_USE_MPI}
368   PARMETIS_metis_LIBRARY PARMETIS_parmetis_LIBRARY)
369 if(FOAM_ENABLE_PARMETIS AND NOT FOAM_USE_MPI)
370   message(SEND_ERROR
371     "ParMetis requires FOAM_USE_MPI to be enabled.")
372 endif()
373 if(FOAM_ENABLE_PARMETIS AND NOT FOAM_ENABLE_METIS)
374   message(SEND_ERROR
375     "ParMetis requires FOAM_ENABLE_METIS to be enabled.")
376 endif()
377 set(SCOTCH_USE_ERREXIT TRUE)
378 foam_thirdparty_option(SCOTCH "" SCOTCH FALSE ON SCOTCH_scotch_LIBRARY
379   SCOTCH_scotcherr_LIBRARY SCOTCH_scotcherrexit_LIBRARY)
380 # do not enable mgridgen by default (licensing issues)
381 if(NOT FOAM_DOUBLE_PRECISION)
382   set(MGRIDGEN_USE_REAL ON)
383 endif()
384 foam_thirdparty_option(MGRIDGEN
385   "Required by the MGridGen GAMG agglomerator. LICENSE UNCLEAR"
386   MGRIDGEN TRUE OFF)
387 # do not enable libccmio by default (licensing issues)
388 foam_thirdparty_option(ccmio
389   "Required by ccm26ToFoam. REQUIRES PERMISSION BY CDADAPCO!"
390   Ccmio TRUE OFF)
391 foam_thirdparty_option(zlib "" ZLIB FALSE ON)
393 # figure out default Pstream library
394 if(FOAM_USE_MPI)
395   set(_FOAM_DEFAULT_PSTREAM mpi)
396 else()
397   set(_FOAM_DEFAULT_PSTREAM dummy)
398 endif()
399 set(FOAM_DEFAULT_PSTREAM ${_FOAM_DEFAULT_PSTREAM} CACHE STRING
400   "Default Pstream library implementation [dummy|mpi]")
401 mark_as_advanced(FOAM_DEFAULT_PSTREAM)
403 # find m4 macro processor
404 find_program(M4_EXECUTABLE m4 DOC "Path to the m4 macro processor")
405 mark_as_advanced(M4_EXECUTABLE)
406 if(NOT M4_EXECUTABLE)
407   message("WARNING: Failed to find M4 macro processor.\n"
408     "Some of the tutorials will fail if it can't be found.")
409   set(M4_EXECUTABLE m4)
410 endif()
412 # find gnuplot executable
413 find_program(GNUPLOT_EXECUTABLE gnuplot DOC "Path to the gnuplot program")
414 mark_as_advanced(GNUPLOT_EXECUTABLE)
415 if(NOT GNUPLOT_EXECUTABLE)
416   message("WARNING: Failed ot find gnuplot.\n"
417     "Some tutorials will not create quantitative comparison plots.")
418 endif()
420 # on APPLE use cp -R -P -p, otherwise use cp -a
421 if(APPLE)
422   set(FOAM_CP_A_FLAGS "-R -P -p")
423 else()
424   set(FOAM_CP_A_FLAGS "-a")
425 endif()
427 # execinfo.h and cxxabi.h only work using GNU gcc and Debug config
428 # assume that if we have execinfo.h, cxxabi.h is also present.
429 if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL Debug)
430   find_package(Execinfo)
431 endif()
433 # create the FOAMConfig.h file
434 configure_file(${CMAKE_SOURCE_DIR}/FOAMConfig.h.in
435   ${CMAKE_BINARY_DIR}/include/FOAMConfig.h @ONLY)
437 # on Solaris/SunOS fix up the shebangs
438 if(CMAKE_SYSTEM_NAME STREQUAL SunOS AND NOT EXISTS ${CMAKE_BINARY_DIR}/replaceAllShellSun.run)
439   message(STATUS "Fixing shell-interpreter for SunOS and Solaris")
440   execute_process(
441     COMMAND ${CMAKE_SOURCE_DIR}/data/utilities/replaceAllShellSun bin
442     COMMAND ${CMAKE_SOURCE_DIR}/data/utilities/replaceAllShellSun data
443     COMMAND ${CMAKE_SOURCE_DIR}/data/utilities/replaceAllShellSun tutorials
444     COMMAND ${CMAKE_SOURCE_DIR}/data/utilities/replaceAllShellSun doc
445     COMMAND ${CMAKE_COMMAND} -E touch${CMAKE_BINARY_DIR}/replaceAllShellSun.run
446     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
447     )
448 endif()
450 # set up defines
451 set(FOAM_COMPILE_DEFINITIONS
452   -D${FOAM_PRECISION}
453   -DNoRepository
454   -D${FOAM_OS}
455   )
456 if(APPLE)
457   list(APPEND FOAM_COMPILE_DEFINITIONS -Ddarwin)
458 endif()
459 add_definitions(${FOAM_COMPILE_DEFINITIONS})
461 # set up include-directories for own headers
462 include_directories(${CMAKE_BINARY_DIR}/include)
464 # descend into the sources...
465 add_subdirectory(bin)
466 add_subdirectory(etc)
467 add_subdirectory(data)
468 add_subdirectory(src)
469 add_subdirectory(applications)
470 add_subdirectory(tutorials)
471 add_subdirectory(doc)
473 # export the library dependencies to the build tree
474 foam_export_targets_to_build_tree(${PROJECT_NAME}LibraryDepends)
475 export(PACKAGE ${PROJECT_NAME})
477 # write the doc index file and install it
478 foam_write_doc_index()
479 install(FILES
480   ${CMAKE_BINARY_DIR}/InstallFiles/data/DoxyDocIndex
481   DESTINATION ${FOAM_INSTALL_DATA_PATH}
482   COMPONENT data
483   )
485 # create ${PROJECT_NAME}Config.cmake ${PROJECT_NAME}Use.cmake,
486 # ${PROJECT_NAME}Utilities.cmake and ${PROJECT_NAME}WmakeCompatibility.cmake
487 # for the build and install tree
488 foam_configure_files(ConfigInstallFiles
489   "CMake/FOAMConfig.cmake.in==CMake/${PROJECT_NAME}Config.cmake"
490   "CMake/FOAMUse.cmake.in==CMake/${PROJECT_NAME}Use.cmake"
491   "CMake/FOAMWmakeCompatibility.cmake.in==CMake/${PROJECT_NAME}WmakeCompatibility.cmake"
492   COPYONLY
493   "CMake/FOAMUtilities.cmake==CMake/${PROJECT_NAME}Utilities.cmake"
494   )
496 # install the CMake config files
497 install(FILES
498   ${ConfigInstallFiles}
499   DESTINATION ${FOAM_INSTALL_CMAKE_PATH}
500   COMPONENT dev
501   )
503 # install the ${PROJECT_NAME}LibraryDepends.cmake file
504 install(EXPORT ${PROJECT_NAME}LibraryDepends
505   DESTINATION ${FOAM_INSTALL_CMAKE_PATH}
506   NAMESPACE FOAM_
507   COMPONENT dev
508   )
510 # pack things up
511 if(FOAM_ENABLE_CPACK)
512   include(${CMAKE_SOURCE_DIR}/CMake/FOAMCPack.cmake)
513 endif()
515 # uninstall target
516 configure_file(
517   "${CMAKE_SOURCE_DIR}/CMake/Modules/cmake_uninstall.cmake.in"
518   "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
519   @ONLY
520   )
522 add_custom_target(uninstall
523   "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
524   )
526 # print cool feature summary
527 foam_print_feature_summary()
529 # ------------------------- vim: set sw=2 sts=2 et: --------------- end-of-file