Skip to content

Commit 4344804

Browse files
committed
Add adios2 TPL
Taken from commit 8b9f666289cbedee5a9d0a585bbf0b74d03019c7 in SEACAS https://github.com/sandialabs/seacas See spack/spack-packages#1961 Signed-off-by: Christian Glusa <[email protected]>
1 parent 02fb9c9 commit 4344804

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# @HEADER
2+
# *****************************************************************************
3+
# Trilinos: An Object-Oriented Solver Framework
4+
#
5+
# Copyright 2001-2024 NTESS and the Trilinos contributors.
6+
# SPDX-License-Identifier: BSD-3-Clause
7+
# *****************************************************************************
8+
# @HEADER
9+
10+
if (${CMAKE_VERSION} GREATER "3.13")
11+
cmake_policy(SET CMP0074 NEW)
12+
endif()
13+
14+
# First, set up the variables for the (backward-compatible) TriBITS way of
15+
# finding ADIOS2. These are used in case find_package(ADIOS2 ...) is not
16+
# called or does not find HDF5. Also, these variables need to be non-null
17+
# in order to trigger the right behavior in the function
18+
# tribits_tpl_find_include_dirs_and_libraries().
19+
20+
set(REQUIRED_HEADERS adios2.h)
21+
set(REQUIRED_LIBS_NAMES adios2_c adios2_cxx11)
22+
23+
if (TPL_ENABLE_MPI)
24+
set(REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} adios2_c_mpi adios2_cxx11_mpi)
25+
endif()
26+
27+
#
28+
# Second, search for ADIOS2 components (if allowed) using the standard
29+
# find_package(ADIOS2 ...).
30+
#
31+
tribits_tpl_allow_pre_find_package(ADIOS2 ADIOS2_ALLOW_PREFIND)
32+
if (ADIOS2_ALLOW_PREFIND)
33+
34+
message("-- Using find_package(ADIOS2 ...) ...")
35+
set(CMAKE_MODULE_PATH
36+
"${CMAKE_MODULE_PATH}"
37+
"${CMAKE_CURRENT_LIST_DIR}/find_modules"
38+
"${CMAKE_CURRENT_LIST_DIR}/utils"
39+
)
40+
41+
find_package(ADIOS2)
42+
endif()
43+
44+
#
45+
# Third, call tribits_tpl_find_include_dirs_and_libraries()
46+
#
47+
tribits_tpl_find_include_dirs_and_libraries( ADIOS2
48+
REQUIRED_HEADERS ${REQUIRED_HEADERS}
49+
REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES}
50+
)
51+
# NOTE: If find_package(ADIOS2 ...) was called and successfully found ADIOS2,
52+
# then tribits_tpl_find_include_dirs_and_libraries() will use the already-set
53+
# variables TPL_ADIOS2_INCLUDE_DIRS and TPL_ADIOS2_LIBRARIES and then print
54+
# them out (and set some other standard variables as well). This is the final
55+
# "hook" into the TriBITS TPL system.
56+
57+
# If the `find_package(ADIOS2)` is not run, then this may not be set
58+
# Need to determine how this is set in the library that is being used...
59+
60+
if ("${TPL_ADIOS2_PARALLEL}" STREQUAL "")
61+
assert_defined(TPL_ADIOS2_INCLUDE_DIRS)
62+
if ("${TPL_ADIOS2_PARALLEL}" STREQUAL "")
63+
set(TPL_ADIOS2_PARALLEL False CACHE INTERNAL
64+
"True if ADIOS2 compiled with parallel enabled")
65+
endif()
66+
endif()
67+
message(STATUS "TPL_ADIOS2_PARALLEL is ${TPL_ADIOS2_PARALLEL}")

0 commit comments

Comments
 (0)