Skip to content

Commit e82ef36

Browse files
authored
Merge pull request #380 from E3SM-Project/bartgol/fix-config-file
Fix EkatConfig.cmake so that the if statements are non-empty
2 parents 10ab9d3 + 8b4563c commit e82ef36

File tree

6 files changed

+21
-13
lines changed

6 files changed

+21
-13
lines changed

cmake/EkatConfig.cmake.in

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,31 @@ endif()
1616

1717
if (@EKAT_ENABLE_KOKKOS@)
1818
# Kokkos
19-
if (@Kokkos_FOUND@)
20-
find_dependency(Kokkos REQUIRED QUIET HINTS @Kokkos_DIR@)
21-
else()
19+
if (@EKAT_BUILDS_KOKKOS@)
2220
# We're installing Kokkos alongside ekat
2321
find_dependency(Kokkos REQUIRED QUIET HINTS @CMAKE_INSTALL_PREFIX@)
22+
else()
23+
find_dependency(Kokkos REQUIRED QUIET HINTS @Kokkos_DIR@)
2424
endif()
2525
endif()
2626

2727
# yaml-cpp
2828
if (@EKAT_ENABLE_YAML_PARSER@)
29-
if (@yaml-cpp_FOUND@)
30-
find_dependency(yaml-cpp REQUIRED QUIET HINTS @yaml-cpp_DIR@)
31-
else()
29+
if (@EKAT_BUILDS_YAMLCPP@)
3230
# We're installing yaml-cpp alongside ekat
3331
find_dependency(yaml-cpp REQUIRED QUIET HINTS @CMAKE_INSTALL_PREFIX@)
32+
else()
33+
find_dependency(yaml-cpp REQUIRED QUIET HINTS @yaml-cpp_DIR@)
3434
endif()
3535
endif()
3636

3737
if (@EKAT_ENABLE_LOGGING@)
3838
# spdlog
39-
if (@spdlog_FOUND@)
40-
find_dependency(spdlog REQUIRED QUIET HINTS @spdlog_DIR@)
41-
else()
39+
if (@EKAT_BUILDS_SPDLOG@)
40+
# We're installing yaml-cpp alongside ekat
4241
find_dependency(spdlog REQUIRED QUIET HINTS @CMAKE_INSTALL_PREFIX@)
42+
else()
43+
find_dependency(spdlog REQUIRED QUIET HINTS @spdlog_DIR@)
4344
endif()
4445
endif()
4546

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Generic setting that are used regardless of Architecture or Kokkos backend
22

3-
set(Kokkos_ENABLE_DEPRECATED_CODE FALSE CACHE BOOL "")
3+
set(Kokkos_ENABLE_DEPRECATED_CODE_4 FALSE CACHE BOOL "")
44
set(Kokkos_ENABLE_EXPLICIT_INSTANTIATION FALSE CACHE BOOL "")

cmake/tpls/EkatFindKokkos.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,18 @@ if (Kokkos_FOUND)
7272
list (FIND Kokkos_DEVICES ${dev} index)
7373
if (index EQUAL -1)
7474
list (APPEND MISSING_DEVICES ${dev})
75-
set (Kokkos_FOUND FALSE)
7675
endif()
7776
endforeach()
7877
foreach (arch IN ITEMS ${EKAT_FIND_KOKKOS_ARCHS})
7978
list (FIND Kokkos_ARCH ${arch} index)
8079
if (index EQUAL -1)
8180
list (APPEND MISSING_ARCHS ${arch})
82-
set (Kokkos_FOUND FALSE)
8381
endif()
8482
endforeach()
8583
foreach (opt IN ITEMS ${EKAT_FIND_KOKKOS_OPTIONS})
8684
list (FIND Kokkos_OPTIONS ${opt} index)
8785
if (index EQUAL -1)
8886
list (APPEND MISSING_OPTIONS ${arch})
89-
set (Kokkos_FOUND FALSE)
9087
endif()
9188
endforeach()
9289

src/kokkos/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ if (EKAT_SKIP_FIND_KOKKOS)
77
# The user does not want to accidentally get an existing installation,
88
# and instead wants to force a build from the internal submodule
99
include (EkatBuildKokkos)
10+
set (EKAT_BUILDS_KOKKOS ON CACHE BOOL "Whether Ekat builds kokkos" FORCE)
1011
else()
1112
# We first try to use find_package (unless told to skip this phase).
1213
# If that doesn't work, build from submodule
1314
include (EkatFindKokkos)
1415
if (NOT Kokkos_FOUND)
1516
include (EkatBuildKokkos)
17+
set (EKAT_BUILDS_KOKKOS ON CACHE BOOL "Whether Ekat builds kokkos" FORCE)
18+
else()
19+
set (EKAT_BUILDS_KOKKOS OFF CACHE BOOL "Whether Ekat builds kokkos" FORCE)
1620
endif()
1721
endif()
1822

src/logging/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@ if (EKAT_SKIP_FIND_SPDLOG)
77
# The user does not want to accidentally get an existing installation,
88
# and instead wants to force a build from the internal submodule
99
include (EkatBuildSpdlog)
10+
set (EKAT_BUILDS_SPDLOG ON CACHE BOOL "Whether Ekat builds spdlog" FORCE)
1011
else()
1112
# We first try to use find_XYZ. If that doesn't work, build from submodule
1213
message (STATUS "Looking for spdlog ...")
1314
find_package(spdlog QUIET)
1415
if (NOT spdlog_FOUND)
1516
message (STATUS "Looking for spdlog ... NOT FOUND")
1617
include(EkatBuildSpdlog)
18+
set (EKAT_BUILDS_SPDLOG ON CACHE BOOL "Whether Ekat builds spdlog" FORCE)
1719
else()
1820
message (STATUS "Looking for spdlog ... FOUND")
1921
message (STATUS " spdlog_DIR: ${spdlog_DIR}")
22+
set (EKAT_BUILDS_SPDLOG OFF CACHE BOOL "Whether Ekat builds spdlog" FORCE)
2023
endif()
2124
endif()
2225

src/parser/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ if (EKAT_SKIP_FIND_YAML_CPP)
66
# The user does not want to accidentally get an existing installation,
77
# and instead wants to force a build from the internal submodule
88
include (EkatBuildYamlCpp)
9+
set (EKAT_BUILDS_YAMLCPP ON CACHE BOOL "Whether Ekat builds yaml-cpp" FORCE)
910
else()
1011
# I am having issues getting the env var YAML_CPP_ROOT being picked up
1112
# by cmake. I suspect this has to do with the presence of the hyphen
@@ -21,7 +22,9 @@ else()
2122
if (NOT yaml-cpp_FOUND)
2223
message (STATUS "Looking for yaml-cpp ... NOT FOUND")
2324
include(EkatBuildYamlCpp)
25+
set (EKAT_BUILDS_YAMLCPP ON CACHE BOOL "Whether Ekat builds yaml-cpp" FORCE)
2426
else()
27+
set (EKAT_BUILDS_YAMLCPP OFF CACHE BOOL "Whether Ekat builds yaml-cpp" FORCE)
2528
message (STATUS "Looking for yaml-cpp ... FOUND")
2629
message (STATUS " yaml-cpp_DIR: ${yaml-cpp_DIR}")
2730
# It is possible that the installation provides the yaml-cpp target, but not the yaml-cpp::yaml-cpp target. If so, define the alias target

0 commit comments

Comments
 (0)