-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
170 lines (144 loc) · 3.9 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
cmake_minimum_required (VERSION 2.6)
project (PI_QMC)
set (PI_QMC_VERSION_MAJOR 0)
set (PI_QMC_VERSION_MINOR 1)
enable_language(CXX)
find_library(LAPACK_LIB
NAMES
lapack
PATHS
ENV LAPACK
/usr/lib
/usr/local/lib
c:/libraries/lib
ENV LAPACK
)
if(NOT EXISTS ${LAPACK_LIB})
message("** Error finding PI_QMC required library:")
message("** Try setting the LAPACK environtment variable")
message("** to the directory containing lapack")
message(FATAL_ERROR "** PI_QMC requires the LAPACK libary")
else()
message("Found LAPACK: " ${LAPACK_LIB})
endif(NOT EXISTS ${LAPACK_LIB})
find_library(BLAS_LIB
NAMES
blas
PATHS
/usr/lib
/usr/local/lib
c:/libraries/lib
ENV BLAS
PATHS_SUFFIXES
lib
)
if(NOT EXISTS ${BLAS_LIB})
message("** Error finding PI_QMC required library:")
message("** Try setting the BLAS environtment variable")
message("** to the directory containing blas")
message(FATAL_ERROR "** PI_QMC requires the BLAS libary")
else()
message("Found BLAS: " ${BLAS_LIB})
endif(NOT EXISTS ${BLAS_LIB})
find_library(LIBF2C_LIB
NAMES
libf2c
PATHS
/usr/lib
/usr/local/lib
c:/libraries/lib
ENV BLAS
PATHS_SUFFIXES
lib
)
FIND_PACKAGE(LibXml2 REQUIRED)
INCLUDE_DIRECTORIES (SYSTEM "${LIBXML2_INCLUDE_DIR}")
find_library(HDF5_LIB
NAMES
hdf5
PATHS
/usr/lib
/usr/local/lib
c:/libraries/lib
ENV HDF5
PATHS_SUFFIXES
lib
)
if(NOT EXISTS ${HDF5_LIB})
message("** Error finding PI_QMC required library:")
message("** Try setting the HDF5 environtment variable")
message("** to the directory containing hdf5")
message(FATAL_ERROR "** PI_QMC requires the hdf5 libary")
else()
message("Found HDF5: " ${HDF5_LIB})
endif(NOT EXISTS ${HDF5_LIB})
find_library(GSL_LIB
NAMES
gsl
PATHS
/usr/lib
/usr/local/lib
c:/libraries/lib
ENV GSL
PATHS_SUFFIXES
lib
)
if(NOT EXISTS ${GSL_LIB})
message("** Error finding PI_QMC required library:")
message("** Try setting the GSL environtment variable")
message("** to the directory containing gsl")
message(FATAL_ERROR "** PI_QMC requires the GSL libary")
else()
message("Found GSL: " ${GSL_LIB})
endif(NOT EXISTS ${GSL_LIB})
find_library(FFTW3_LIB
NAMES
fftw3
PATHS
/usr/lib
/usr/local/lib
c:/libraries/lib
ENV FFTW3
PATHS_SUFFIXES
lib
)
if(NOT EXISTS ${FFTW3_LIB})
message("** Error finding PI_QMC required library:")
message("** Try setting the FFTW3 environtment variable")
message("** to the directory containing fftw3")
message(FATAL_ERROR "** PI_QMC requires the FFTW3 libary")
else()
message("Found FFTW3: " ${FFTW3_LIB})
endif(NOT EXISTS ${FFTW3_LIB})
set(BLITZ_INCLUDE_DIR ${PI_QMC_SOURCE_DIR}/contrib/blitz-0.9)
include(CheckIncludeFiles)
CHECK_INCLUDE_FILES(getopt.h HAVE_GETOPT_H)
configure_file (
"${PI_QMC_SOURCE_DIR}/config_cmake.h.in"
"${PI_QMC_BINARY_DIR}/config.h"
)
INCLUDE_DIRECTORIES(
${PI_QMC_BINARY_DIR}
${PI_QMC_SOURCE_DIR}/lib
${PI_QMC_SOURCE_DIR}/src
${BLITZ_INCLUDE_DIR})
add_definitions(-DHAVE_CONFIG_H)
set(EXECUTABLE_OUTPUT_PATH ${PI_QMC_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PI_QMC_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PI_QMC_BINARY_DIR}/lib)
add_custom_target(unittest)
set (GTEST_SOURCE_DIR ${PI_QMC_SOURCE_DIR}/contrib/gtest-1.6.0)
add_subdirectory(${GTEST_SOURCE_DIR})
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/etc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doc/etc/Doxyfile @ONLY)
add_custom_target(doxygen
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/etc/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/etc
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
add_subdirectory(src)
add_subdirectory(unit-tests)
add_subdirectory(test)