-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
72 lines (62 loc) · 2.3 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
# Main CMake config file for fpde2 project
# @todo move compiler selecting, flag settings stuff out of this file
# @todo design a better test machine (which will select some predefined
# types of tests for different files)
cmake_minimum_required(VERSION 2.8)
# project name and language
project( fpde2 Fortran )
# library name
set(project_lib_name "${CMAKE_PROJECT_NAME}")
# @todo add VERSION and SOVERSION of fpde2 (in future)
message(STATUS "Building up ${CMAKE_PROJECT_NAME}")
# selecting Fortran compiler
include(CMakeForceCompiler)
cmake_force_fortran_compiler(ifort "Intel")
# the tools for creating libraries
# selecting archiver
find_program(xiar xiar)
if(xiar)
set(CMAKE_AR "${xiar}")
set(CMAKE_RANLIB "${xiar}")
endif(xiar)
mark_as_advanced(xiar)
#SET (CMAKE_C_ARCHIVE_APPEND "echo append")
# selecting linker
find_program(xild xild)
if(xild)
set(CMAKE_LINKER "${xild}")
endif(xild)
mark_as_advanced(xild)
# printing some software info
message(STATUS "Fortran compiler: ${CMAKE_Fortran_COMPILER_ID}")
message(STATUS "Archiver: ${CMAKE_AR}")
message(STATUS "Linker: ${CMAKE_LINKER}")
# variables used in out of source build
set( LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib )
#set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake )
# .mod files output directory (fortran specific)
set( CMAKE_Fortran_MODULE_DIRECTORY ${LIBRARY_OUTPUT_PATH}/mod)
# add the above path to include path
include_directories( ${LIBRARY_OUTPUT_PATH} )
# set Intel Fortran compiler flags
# @todo this should be done better
# FLAGS - generic flags
# DFLAGS - debugging flags
# OFLAGS - optimization flags
# PFLAGS - precision flags
set(Fortran77_FLAGS "" )
set(Fortran77_DFLAGS "")
set(Fortran77_OFLAGS "-O3")
set(Fortran77_PFLAGS "-fp-model strict -double-size 128 -integer-size 64")
set(Fortran90_FLAGS "-stand f08 -u -warn all -warn nounused -check all -cpp" )
set(Fortran90_DFLAGS "-debug all -gen-interfaces -traceback")
set(Fortran90_OFLAGS "-O3")
set(Fortran90_PFLAGS "-fp-model strict -real-size 128 -integer-size 64")
# set external libraries required by this project
set(external_libs "")
# add a subdirectory with source files for the project
add_subdirectory(src)
# subdirectory with tests
add_subdirectory(test)
include(${PROJECT_SOURCE_DIR}/test/CMakeTests.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/config/doxygen.cmake)