-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
79 lines (70 loc) · 2.51 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
# This program is a part of EASIFEM version 2023.1.0 Copyright (C) 2020-2023
# Vikas Sharma Website: www.easifem.com
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https: //www.gnu.org/licenses/>
#
cmake_minimum_required(VERSION 3.20.0 FATAL_ERROR)
set(PROJECT_NAME "meshio")
project(${PROJECT_NAME})
enable_language(Fortran)
set(TARGET_NAME "meshio")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE
Debug
CACHE STRING "Build type" FORCE)
endif()
if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU" OR Fortran_COMPILER_NAME MATCHES
"gfortran*")
list(APPEND FORTRAN_FLAGS "-ffree-form" "-ffree-line-length-none"
"-std=f2008" "-fimplicit-none")
list(APPEND FORTRAN_FLAGS_RELEASE "-O3")
list(
APPEND
FORTRAN_FLAGS_DEBUG
"-fbounds-check"
"-g"
"-fbacktrace"
"-Wextra"
"-Wall"
"-fprofile-arcs"
"-ftest-coverage"
"-Wimplicit-interface")
elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" OR Fortran_COMPILER_NAME
MATCHES "ifort*")
list(APPEND FORTRAN_FLAGS "-r8" "-W1")
list(APPEND FORTRAN_FLAGS_RELEASE "-O3")
list(
APPEND
FORTRAN_FLAGS_DEBUG
"-O0"
"-traceback"
"-g"
"-debug all"
"-check all"
"-ftrapuv"
"-warn"
"nointerfaces")
elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "XL" OR Fortran_COMPILER_NAME
MATCHES "xlf*")
list(APPEND FORTRAN_FLAGS "-q64" "-qrealsize=8" "-qsuffix=f=f90:cpp=f90")
list(APPEND FORTRAN_FLAGS_RELEASE "-O3" "-qstrict")
list(APPEND FORTRAN_FLAGS_DEBUG "-O0" "-g" "-qfullpath" "-qkeepparm")
else()
message(ERROR "No optimized Fortran compiler flags are known")
endif()
list(APPEND CMAKE_PREFIX_PATH "$ENV{EASIFEM_EXTPKGS}" "$ENV{EASIFEM_BASE}"
"$ENV{EASIFEM_CLASSES}")
find_package(easifemClasses)
add_executable(${TARGET_NAME} main.F90)
target_link_libraries(${TARGET_NAME} easifemClasses::easifemClasses)