3
3
#
4
4
# SPDX-License-Identifier: (BSD-3-Clause)
5
5
6
- # This file is intended to be included in the *- config.cmake files of
7
- # any project using a third-party library. The macro
8
- # `blt_install_tpl_setups(DESTINATION <dir>)` installs this file
6
+ # This file is intended to be included in the installed config files of
7
+ # any project using BLT's third-party library as well as in a BLT project.
8
+ # The macro `blt_install_tpl_setups(DESTINATION <dir>)` installs this file
9
9
# into the destination specified by the argument <dir>.
10
10
11
11
# BLTInstallableMacros provides helper macros for setting up and creating
14
14
if (NOT BLT_LOADED)
15
15
include ("${CMAKE_CURRENT_LIST_DIR} /BLTInstallableMacros.cmake" )
16
16
endif ()
17
- # If the generated TPL config file exists, include it here.
17
+
18
+ # Handle the two cases of TPL config variables, installed from upstream project
19
+ # and the current/main BLT project. Prefix all variables here to not conflict with
20
+ # non-BLT projects that load this as a configuration file.
18
21
if (EXISTS "${CMAKE_CURRENT_LIST_DIR} /BLTThirdPartyConfigFlags.cmake" )
22
+ # Case: Imported BLT project (ie. an installed TPL loading its BLT targets)
19
23
include ("${CMAKE_CURRENT_LIST_DIR} /BLTThirdPartyConfigFlags.cmake" )
20
24
else ()
21
- # Otherwise, configure the TPL flags. We have to prefix these variables with
22
- # BLT so that they never conflict with user-level CMake variables in downstream
23
- # projects.
24
- #
25
- # We have to do some checks before we overwrite these internal variables to assure
26
- # that we don't turn off a third-party library enabled by the dependency.
27
- if (NOT DEFINED BLT_ENABLE_HIP OR NOT ${BLT_ENABLE_HIP} )
25
+ # Case: Main BLT project (ie. a project loading it's own BLT)
26
+ #
27
+ # Always stay enabled if any upstream has already turned you on.
28
+ if (NOT BLT_ENABLE_HIP)
28
29
set (BLT_ENABLE_HIP ${ENABLE_HIP} )
29
30
endif ()
30
- if (NOT DEFINED BLT_ENABLE_CUDA OR NOT ${BLT_ENABLE_CUDA} )
31
+ if (NOT BLT_ENABLE_CUDA)
31
32
set (BLT_ENABLE_CUDA ${ENABLE_CUDA} )
32
33
endif ()
33
- if (NOT DEFINED BLT_ENABLE_MPI OR NOT ${BLT_ENABLE_MPI} )
34
+ if (NOT BLT_ENABLE_MPI)
34
35
set (BLT_ENABLE_MPI ${ENABLE_MPI} )
35
36
endif ()
36
- if (NOT DEFINED BLT_ENABLE_OPENMP OR NOT ${BLT_ENABLE_OPENMP} )
37
+ if (NOT BLT_ENABLE_OPENMP)
37
38
set (BLT_ENABLE_OPENMP ${ENABLE_OPENMP} )
38
39
endif ()
39
- if (NOT DEFINED BLT_ENABLE_FIND_MPI OR NOT ${BLT_ENABLE_FIND_MPI} )
40
+ if (NOT BLT_ENABLE_FIND_MPI)
40
41
set (BLT_ENABLE_FIND_MPI ${ENABLE_FIND_MPI} )
41
42
endif ()
42
- set (BLT_ENABLE_CLANG_CUDA ${ENABLE_CLANG_CUDA} )
43
+ if (NOT BLT_ENABLE_CLANG_CUDA)
44
+ set (BLT_ENABLE_CLANG_CUDA ${ENABLE_CLANG_CUDA} )
45
+ endif ()
46
+
47
+ message (STATUS "BLT MPI support is ${BLT_ENABLE_MPI} " )
48
+ message (STATUS "BLT OpenMP support is ${BLT_ENABLE_OPENMP} " )
49
+ message (STATUS "BLT CUDA support is ${BLT_ENABLE_CUDA} " )
50
+ message (STATUS "BLT HIP support is ${BLT_ENABLE_HIP} " )
43
51
endif ()
44
52
45
53
# Detect if Fortran has been introduced.
46
54
get_property (_languages GLOBAL PROPERTY ENABLED_LANGUAGES )
47
55
if (_languages MATCHES "Fortran" )
48
- set (_fortran_already_enabled TRUE )
56
+ set (_fortran_already_enabled TRUE )
49
57
else ()
50
- set (_fortran_already_enabled FALSE )
58
+ set (_fortran_already_enabled FALSE )
51
59
endif ()
52
60
53
61
# Only update ENABLE_FORTRAN if it is a new requirement, don't turn
@@ -62,8 +70,8 @@ endif()
62
70
# MPI
63
71
#------------------------------------
64
72
if (NOT TARGET mpi)
65
- message (STATUS "MPI Support is ${BLT_ENABLE_MPI} " )
66
73
if (BLT_ENABLE_MPI AND EXISTS "${CMAKE_CURRENT_LIST_DIR} /thirdparty/BLTSetupMPI.cmake" )
74
+ message (STATUS "Creating BLT MPI targets..." )
67
75
include ("${CMAKE_CURRENT_LIST_DIR} /thirdparty/BLTSetupMPI.cmake" )
68
76
endif ()
69
77
endif ()
@@ -73,8 +81,8 @@ endif()
73
81
# OpenMP
74
82
#------------------------------------
75
83
if (NOT TARGET openmp)
76
- message (STATUS "OpenMP Support is ${BLT_ENABLE_OPENMP} " )
77
84
if (BLT_ENABLE_OPENMP AND EXISTS "${CMAKE_CURRENT_LIST_DIR} /thirdparty/BLTSetupOpenMP.cmake" )
85
+ message (STATUS "Creating BLT OpenMP targets..." )
78
86
include ("${CMAKE_CURRENT_LIST_DIR} /thirdparty/BLTSetupOpenMP.cmake" )
79
87
endif ()
80
88
endif ()
@@ -84,8 +92,8 @@ endif()
84
92
# CUDA
85
93
#------------------------------------
86
94
if (NOT TARGET cuda)
87
- message (STATUS "CUDA Support is ${BLT_ENABLE_CUDA} " )
88
95
if (BLT_ENABLE_CUDA AND EXISTS "${CMAKE_CURRENT_LIST_DIR} /thirdparty/BLTSetupCUDA.cmake" )
96
+ message (STATUS "Creating BLT CUDA targets..." )
89
97
include ("${CMAKE_CURRENT_LIST_DIR} /thirdparty/BLTSetupCUDA.cmake" )
90
98
endif ()
91
99
endif ()
@@ -95,8 +103,8 @@ endif()
95
103
# HIP
96
104
#------------------------------------
97
105
if (NOT TARGET blt_hip)
98
- message (STATUS "HIP Support is ${BLT_ENABLE_HIP} " )
99
106
if (BLT_ENABLE_HIP AND EXISTS "${CMAKE_CURRENT_LIST_DIR} /thirdparty/BLTSetupHIP.cmake" )
107
+ message (STATUS "Creating BLT HIP targets..." )
100
108
include ("${CMAKE_CURRENT_LIST_DIR} /thirdparty/BLTSetupHIP.cmake" )
101
109
endif ()
102
110
endif ()
0 commit comments