forked from evaleev/libint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibint2-config.cmake.in
237 lines (217 loc) · 8.93 KB
/
libint2-config.cmake.in
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# libint2-config.cmake
# --------------------
#
# Libint2 cmake module.
# This module sets the following variables in your project:
#
# ::
#
# Libint2_FOUND - true if Libint2 and all required components found on the system
# Libint2_VERSION - Libint2 version in format Major.Minor.Release
# Libint2_EXT_VERSION - Libint2 version including the (optional) buildid, such as beta.3
# Libint2_MAX_AM_ERI - maximum angular momentum level of Libint2 libraries for 4-center integrals
#
#
# Target variables:
#
# It is preferred to use properties set on the base target rather than using the above variables.
#
# ::
#
# Libint2_VERSION - Libint2 version in format Major.Minor.Release
# Libint2_MAX_AM_ERI - maximum angular momentum level of Libint2 libraries for 4-center integrals
# Libint2_CONFIGURATION - list of library configuration characteristics such as orderings, integrals
# classes, and derivative and angular momentum limits. These use the notation of CMake components
# (see next section), excepting the build characteristics like shared/static and C/CXX_ho/CXX/Fortran.
#
# get_property(_ver TARGET Libint2::int2 PROPERTY Libint2_VERSION)
#
#
# Available components:
#
# ::
#
# shared - search for only shared library
# static - search for only static library
#
# onebody_dD_lL - search for library including 1-body integrals with derivative order D (D=0..4) and max angular momentum up to L (L=2..10)
# eri_cC_dD_lL - search for library including 2-body integrals with C (C=2,3,4) centers, derivative order D (D=0..4), and max angular momentum up to L (L=2..10)
# g12_dD-lL - search for library including F12 integrals with Gaussian factors with derivative order D and max angular momentum up to L
# g12dkh_dD-lL - search for library including F12 integrals with Gaussian factors and DKH with derivative order D and max angular momentum up to L (NYI)
#
# impure_sh - search for library that doesn't assume 2- and 3-center integrals involve pure solid harmonics
#
# sph cart shell_set used_by
# -------- -------- --------- -------
# sss - search for standard + standard + standard = mpqc4, cp2k
# sso - search for + orca
# sis - search for + intv3 + standard = mpqc3
# sio - search for + orca
# sgs - search for + gamess + standard = gamess
# sgo - search for + orca
# sos - search for + orca + standard
# soo - search for + orca = orca
# sbs - search for + bagel + standard = bagel
# sbo - search for + orca
# gss - search for gaussian + standard + standard = psi4 (since v1.4)
# gso - search for + orca
# gis - search for + intv3 + standard
# gio - search for + orca
# ggs - search for + gamess + standard
# ggo - search for + orca
# gos - search for + orca + standard
# goo - search for + orca
# gbs - search for + bagel + standard
# gbo - search for + orca
#
# C - search for at least Libint2::int2 target
# CXX_ho - search for at least Libint2::cxx target
# CXX - search for at least Libint2::int2-cxx target
# Fortran - search for at least libint_f target (NYI)
#
#
# Exported targets:
#
# ::
#
# If Libint2 is found and no language components are requested, this module
# defines at least the following :prop_tgt:`IMPORTED` target. ::
#
# Libint2::int2 - library with C API
#
# If Libint2 is found, depending on components requested, available
# dependencies, and fullness of the installation, this module defines up to the
# following :prop_tgt:`IMPORTED` targets. ::
#
# Libint2::int2 - library with C API (COMPONENT C)
# Libint2::cxx - Libint2::int2 plus interface to header-only C++11 API (COMPONENT CXX_ho)
# Libint2::int2-cxx - Libint2::int2 plus compiled C++11 API (COMPONENT CXX)
# Libint2::fortran (NYI)
#
#
# Suggested usage:
#
# ::
#
# find_package(Libint2)
# find_package(Libint2 2.7.1 CONFIG REQUIRED COMPONENTS shared sss eri_c4_d0_l5 eri_c4_d1_l4)
#
#
# The following variables can be set to guide the search for this package:
#
# ::
#
# Libint2_DIR - CMake variable, set to directory containing this Config file
# CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package
# CMAKE_DISABLE_FIND_PACKAGE_Libint2 - CMake variable, disables
# find_package(Libint2) when not REQUIRED, perhaps to force internal build
@PACKAGE_INIT@
set(pnv libint2) # projectnameversion
set(L2 Libint2) # NameSpace
set(Libint2_EXT_VERSION "@LIBINT_EXT_VERSION@")
# make detectable the various cmake modules exported alongside
# * prepend to trump any pre-target FindEigen3.cmake modules lying around
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
# check library style component
if(@BUILD_SHARED_LIBS@) # BUILD_SHARED_LIBS
set(${L2}_shared_FOUND 1)
endif()
if(@BUILD_STATIC_LIBS@) # BUILD_STATIC_LIBS
set(${L2}_static_FOUND 1)
endif()
list(FIND ${L2}_FIND_COMPONENTS "shared" _seek_shared)
list(FIND ${L2}_FIND_COMPONENTS "static" _seek_static)
# check library language component
include(CMakeFindDependencyMacro)
set(${L2}_C_FOUND 1)
list(FIND ${L2}_FIND_COMPONENTS "C" _seek_C)
if(@LIBINT2_REQUIRE_CXX_API@) # LIBINT2_REQUIRE_CXX_API
if(NOT TARGET Eigen3::Eigen)
find_dependency(Eigen3 REQUIRED)
endif()
if (@LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS@)
# Boost headers _not_ unpacked to within `include/libint2/`
if (NOT TARGET Boost::headers)
find_dependency(Boost 1.57 REQUIRED)
endif()
else()
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Boost detected. satisfied by headers bundled with ${L2} distribution")
endif()
endif()
set(${L2}_CXX_ho_FOUND 1)
if(@LIBINT2_REQUIRE_CXX_API_COMPILED@) # LIBINT2_REQUIRE_CXX_API_COMPILED
set(${L2}_CXX_FOUND 1)
endif()
endif()
list(FIND ${L2}_FIND_COMPONENTS "CXX_ho" _seek_CXX_ho)
list(FIND ${L2}_FIND_COMPONENTS "CXX" _seek_CXX)
if(@LIBINT2_ENABLE_FORTRAN@) # LIBINT2_ENABLE_FORTRAN
set(${L2}_Fortran_FOUND 1)
endif()
list(FIND ${L2}_FIND_COMPONENTS "Fortran" _seek_Fortran)
# check AM & derivative component
set(${L2}_MAX_AM_ERI @Libint2_MAX_AM_ERI@)
foreach(_eri @Libint2_ERI_COMPONENTS@)
set(${L2}_${_eri}_FOUND 1)
endforeach()
# check pure restriction component
if((@ERI3_PURE_SH@ EQUAL 0) AND (@ERI2_PURE_SH@ EQUAL 0)) # ERI3/ERI2_PURE_SH
set(${L2}_impure_sh_FOUND 1)
endif()
list(FIND ${L2}_FIND_COMPONENTS "impure_sh" _seek_impure_sh)
# check orderings component:
# LIBINT_SHGSHELL_ORDERING = @LIBINT_SHGSHELL_ORDERING@
# LIBINT_CGSHELL_ORDERING = @LIBINT_CGSHELL_ORDERING@
# LIBINT_SHELL_SET = @LIBINT_SHELL_SET@
set(${L2}_@Libint2_ORDERINGS_CODE@_FOUND 1)
# thanks, https://stackoverflow.com/a/9328525
function(dump_cmake_variables)
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
set(founds "")
foreach (_variableName ${_variableNames})
if (ARGV0)
unset(MATCHED)
string(REGEX MATCH ${ARGV0} MATCHED ${_variableName})
if (NOT MATCHED)
continue()
endif()
if (NOT ${${_variableName}})
continue()
endif()
endif()
list(APPEND found ${CMAKE_MATCH_1})
endforeach()
message(STATUS "${ARGV1}${found}")
endfunction()
if(NOT CMAKE_REQUIRED_QUIET)
list(SORT ${L2}_FIND_COMPONENTS COMPARE STRING)
message(STATUS "${L2}Config components requested: ${${L2}_FIND_COMPONENTS}")
dump_cmake_variables("^Libint2_([A-Za-z0-9_]+)_FOUND$" "${L2}Config components found: ")
endif()
check_required_components(${L2})
#-----------------------------------------------------------------------------
# Don't include targets if this file is being picked up by another
# project which has already built this as a subproject
#-----------------------------------------------------------------------------
if(NOT TARGET ${L2}::int2)
if(_seek_static GREATER -1)
include("${CMAKE_CURRENT_LIST_DIR}/${pnv}-targets-static.cmake")
elseif(_seek_shared GREATER -1)
include("${CMAKE_CURRENT_LIST_DIR}/${pnv}-targets-shared.cmake")
elseif(@BUILD_SHARED_LIBS@) # BUILD_SHARED_LIBS
include("${CMAKE_CURRENT_LIST_DIR}/${pnv}-targets-shared.cmake")
elseif(@BUILD_STATIC_LIBS@) # BUILD_STATIC_LIBS
include("${CMAKE_CURRENT_LIST_DIR}/${pnv}-targets-static.cmake")
endif()
get_property(_loc TARGET ${L2}::int2 PROPERTY LOCATION)
get_property(_ill TARGET ${L2}::int2 PROPERTY INTERFACE_LINK_LIBRARIES)
get_property(_id TARGET ${L2}::int2 PROPERTY INCLUDE_DIRECTORIES)
get_property(_iid TARGET ${L2}::int2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
message(DEBUG "Libint2::int2")
message(DEBUG "loc ${_loc}")
message(DEBUG "ill ${_ill}")
message(DEBUG "id ${_id}")
message(DEBUG "iid ${_iid}")
endif()