-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCMakeLists.txt
62 lines (51 loc) · 1.92 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
cmake_minimum_required (VERSION 3.0)
if (COMMAND cmake_policy)
cmake_policy (SET CMP0003 NEW)
endif (COMMAND cmake_policy)
project (GFTL
VERSION 1.3.1
LANGUAGES Fortran)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/installed" CACHE PATH "..." FORCE)
message("-- Setting default install prefix to ${CMAKE_INSTALL_PREFIX}.")
message(" Override with -DCMAKE_INSTALL_PREFIX=<path>.")
endif ()
# For BSD systems use GNU m4
find_program( M4 NAMES "gm4" "m4")
if( NOT M4 )
message( SEND_ERROR "m4 program not found" )
endif()
add_subdirectory (include)
add_subdirectory (examples)
find_package (PFUNIT 4.1 QUIET)
if (PFUNIT_FOUND)
message("-- Detecting pFUnit: ${PFUNIT_DIR}")
project (GFTL-TEST
VERSION ${GFTL_VERSION}
LANGUAGES Fortran
)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${GFTL_SOURCE_DIR}/cmake_utils")
include (${CMAKE_Fortran_COMPILER_ID} RESULT_VARIABLE found)
include (CheckFortranSource)
include (CheckCompilerCapabilities)
enable_testing()
if (NOT TARGET tests)
add_custom_target(tests COMMAND ${CMAKE_CTEST_COMMAND})
endif ()
add_subdirectory(tests EXCLUDE_FROM_ALL)
endif ()
configure_file(GFTLConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/GFTLConfig.cmake @ONLY)
configure_file(GFTLConfig-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/GFTLConfig-version.cmake @ONLY)
set (top_dir "GFTL-${GFTL_VERSION_MAJOR}.${GFTL_VERSION_MINOR}")
install (
FILES ${CMAKE_CURRENT_BINARY_DIR}/GFTLConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/GFTLConfig-version.cmake
DESTINATION "${top_dir}/cmake"
)
# The following is needed for external projects using *nix make when
# parent project builds gFTL as a subproject.
set (GFTL_TOP_DIR "${CMAKE_INSTALL_PREFIX}/${top_dir}" CACHE PATH "")
configure_file(GFTL.mk.in ${CMAKE_CURRENT_BINARY_DIR}/GFTL.mk @ONLY)
install (
FILES ${CMAKE_CURRENT_BINARY_DIR}/GFTL.mk
DESTINATION "${top_dir}/include"
)