-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·116 lines (84 loc) · 2.72 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
##-------------------------------------------------------
##
## FDM project
##
## By Wenqing Wang
##
## 09.2011
##-------------------------------------------------------
cmake_minimum_required(VERSION 2.4.5)
SET (VERSION_MAJOR 2)
SET (VERSION_MINOR 0)
SET (VERSION_PATCH 0)
IF (WIN32)
SET ( CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE TYPE INTERNAL FORCE )
ADD_DEFINITIONS(-DWIN)
ENDIF (WIN32)
IF (UNIX)
string( LENGTH "$ENV{DESTDIR}" DESTDIRLEN )
IF ( ${DESTDIRLEN} GREATER 0 )
message( STATUS "DESTDIR specified ($ENV{DESTDIR}). Overriding
CMAKE_INSTALL_PREFIX (${CMAKE_INSTALL_PREFIX})" )
set( CMAKE_INSTALL_PREFIX "" CACHE PATH "Use DESTDIR instead of CMAKE_INSTALL_PREFIX" FORCE )
ENDIF()
ENDIF (UNIX)
SET(PROJECT_NAME s_fdm)
# Project name
PROJECT( ${PROJECT_NAME} )
INCLUDE( Cmake/base.cmake )
# Set build directories
# Binaries are created in /bin and libraries in /lib
SET( EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin )
SET( LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib )
# Relative paths are used in the created projects
# May not work correcty due to the CMake docs
#SET( CMAKE_USE_RELATIVE_PATHS TRUE )
IF (MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNINGS)
ENDIF (MSVC)
### For GNU C/CXX.
IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -Wall -Wextra")
ADD_DEFINITIONS(
# -pedantic
-fno-nonansi-builtins
)
ENDIF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
##Sow all compilation messages
SET( CMAKE_VERBOSE_MAKEFILE on )
#Options
#
OPTION(USE_PETSC "Use PETSc libs for parallel computing" OFF)
IF(USE_PETSC)
MESSAGE (STATUS "Configuring for PETSc" )
OPTION(FORCE_PETSC_EXECUTABLE_RUNS "Force CMake to accept a given PETSc configuration" ON)
##Force CMake to accept a given PETSc configuration in case the failure of MPI tests
##This may cause the compilation broken.
IF(FORCE_PETSC_EXECUTABLE_RUNS)
SET(PETSC_EXECUTABLE_RUNS YES)
ENDIF()
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/Cmake/findPETSC")
FIND_PACKAGE(PETSc REQUIRED)
include_directories(
${PETSC_INCLUDES}
)
FIND_PACKAGE(MPI REQUIRED)
ADD_DEFINITIONS(-DUSE_PETSC)
ENDIF(USE_PETSC)
###SET(ROOT_PATH ..)
INCLUDE_DIRECTORIES(
.
###${ROOT_PATH}
)
ADD_DEFINITIONS(
#
)
ADD_SUBDIRECTORY( Common )
ADD_SUBDIRECTORY( Numerics )
ADD_SUBDIRECTORY( Geometry )
ADD_SUBDIRECTORY( LinearSolver )
IF(NOT USE_PETSC)
ADD_SUBDIRECTORY( Math )
ENDIF(NOT USE_PETSC)
ADD_SUBDIRECTORY( FDM )