-
Notifications
You must be signed in to change notification settings - Fork 29
/
CMakeLists.txt
83 lines (64 loc) · 1.74 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
# ldasoft
# This minimum version is mostly set in order to get a newer version
# of the FindMPI check. Note that you can easily install a newer cmake version
# using conda or pip.
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
foreach(policy
CMP0048
CMP0074
CMP0077
)
if(POLICY ${policy})
cmake_policy(SET ${policy} NEW)
endif()
endforeach()
# Set compiler
set(CMAKE_C_COMPILER mpicc)
project(ldasoft VERSION 1.0.0 LANGUAGES C)
# External packages
find_package(GSL REQUIRED)
find_package(OpenMP REQUIRED)
find_package(HDF5 REQUIRED)
find_package(MPI REQUIRED)
find_package(MBH)
# set cflags
if(APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Xpreprocessor")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp -Wall -std=gnu99")
# Set git version header file
message(STATUS "Resolving GIT Version")
find_package(Git)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY "${local_dir}"
OUTPUT_VARIABLE _build_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message( STATUS "GIT hash: ${_build_version}")
else()
message(STATUS "GIT not found")
endif()
# The version number.
set (GITVERSION "\"${_build_version}\"")
configure_file (
"${PROJECT_SOURCE_DIR}/gitversion.h.in"
"${PROJECT_SOURCE_DIR}/utils/src/gitversion.h"
)
install (FILES "${PROJECT_SOURCE_DIR}/utils/src/gitversion.h"
DESTINATION include)
message(STATUS "Resolving GIT Version")
# The version number.
set (GITVERSION "\"${_build_version}\"")
# Internal products
add_subdirectory(utils)
add_subdirectory(ucb)
add_subdirectory(noise)
add_subdirectory(apps)
if(MBH_FOUND)
add_subdirectory(globalfit)
else()
message(STATUS "MBH module not found, skipping GlobalFit install")
endif()