Skip to content

Commit 3c49e34

Browse files
committed
config/cmake: always search for Conduit
Two subsequent searches could have different component requests, so remove the `CONDUIT_FOUND` guard that skips over that logic.
1 parent fa2dc9d commit 3c49e34

File tree

1 file changed

+71
-76
lines changed

1 file changed

+71
-76
lines changed

src/config/ConduitConfig.cmake.in

Lines changed: 71 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -16,82 +16,77 @@ cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
1616

1717
@PACKAGE_INIT@
1818

19-
if(NOT CONDUIT_FOUND)
19+
# Compute the installation prefix relative to this file.
20+
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
21+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
22+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
23+
if(_IMPORT_PREFIX STREQUAL "/")
24+
set(_IMPORT_PREFIX "")
25+
endif()
2026

21-
# Compute the installation prefix relative to this file.
22-
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
23-
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
24-
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
25-
if(_IMPORT_PREFIX STREQUAL "/")
26-
set(_IMPORT_PREFIX "")
27+
set(CONDUIT_VERSION "@PROJECT_VERSION@")
28+
# keep CONDUIT_USE_CXX11 to support old install logic
29+
set(CONDUIT_USE_CXX11 "@CONDUIT_USE_CXX11@")
30+
set(CONDUIT_USE_CXX14 "@CONDUIT_USE_CXX14@")
31+
set(CONDUIT_USE_FMT "@CONDUIT_USE_FMT@")
32+
set(CONDUIT_USE_CALIPER "@CONDUIT_USE_CALIPER@")
33+
set(CONDUIT_USE_OPENMP "@ENABLE_OPENMP@")
34+
set(CONDUIT_INSTALL_PREFIX "@CONDUIT_INSTALL_PREFIX@")
35+
set(CONDUIT_ZLIB_DIR "@ZLIB_DIR@")
36+
set(CONDUIT_HDF5_DIR "@HDF5_DIR@")
37+
set(CONDUIT_ADIOS_DIR "@ADIOS_DIR@")
38+
set(CONDUIT_SILO_DIR "@SILO_DIR@")
39+
set(CONDUIT_METIS_DIR "@METIS_DIR@")
40+
set(CONDUIT_PARMETIS_DIR "@PARMETIS_DIR@")
41+
set(CONDUIT_ADIAK_DIR "@ADIAK_DIR@")
42+
set(CONDUIT_CALIPER_DIR "@CALIPER_DIR@")
43+
set(CONDUIT_PYTHON_ENABLED "@PYTHON_FOUND@")
44+
set(CONDUIT_PYTHON_EXECUTABLE "@PYTHON_EXECUTABLE@")
45+
set(CONDUIT_PYTHON_MODULE_DIR "@CONDUIT_INSTALL_PYTHON_MODULE_DIR@")
46+
set(CONDUIT_PYTHON_MODULE_CUSTOM_PREFIX "@CONDUIT_INSTALL_PYTHON_MODULE_CUSTOM_PREFIX@")
47+
set(CONDUIT_USE_CMAKE_MPI_TARGETS "@CONDUIT_USE_CMAKE_MPI_TARGETS@")
48+
49+
get_filename_component(CONDUIT_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
50+
51+
# setup dependent pkgs
52+
include(${CONDUIT_CMAKE_CONFIG_DIR}/conduit_setup_deps.cmake)
53+
54+
# include targets exported by cmake
55+
include(${CONDUIT_CMAKE_CONFIG_DIR}/conduit.cmake)
56+
57+
# finally setup our final imported targets
58+
include(${CONDUIT_CMAKE_CONFIG_DIR}/conduit_setup_targets.cmake)
59+
60+
set(Conduit_FOUND TRUE)
61+
62+
set(_conduit_known_components
63+
MPI)
64+
foreach(_conduit_component IN LISTS Conduit_FIND_COMPONENTS)
65+
if (NOT _conduit_component IN_LIST _conduit_known_components)
66+
set("Conduit_${_conduit_component}_FOUND" 0)
67+
set("Conduit_${_conduit_component}_NOT_FOUND_MESSAGE"
68+
"Unknown component ${_conduit_component}")
69+
70+
if(Conduit_FIND_REQUIRED_${_conduit_component})
71+
set(Conduit_FOUND 0)
72+
list(APPEND Conduit_NOT_FOUND_MESSAGE
73+
"Unknown component ${_conduit_component}")
2774
endif()
75+
else()
76+
if(NOT DEFINED Conduit_${_conduit_component}_FOUND)
77+
set("Conduit_${_conduit_component}_FOUND" 0)
78+
set("Conduit_${_conduit_component}_NOT_FOUND_MESSAGE"
79+
"Component ${_conduit_component} was not found (unimplemented?)")
80+
endif()
81+
if(NOT Conduit_${_conduit_component}_FOUND AND
82+
Conduit_FIND_REQUIRED_${_conduit_component})
83+
set(Conduit_FOUND 0)
84+
list(APPEND Conduit_NOT_FOUND_MESSAGE
85+
"Component ${_conduit_component} was not found: ${Conduit_${_conduit_component}_NOT_FOUND_MESSAGE}")
86+
endif()
87+
endif()
88+
endforeach()
89+
unset(_conduit_known_components)
90+
unset(_conduit_component)
2891

29-
set(CONDUIT_VERSION "@PROJECT_VERSION@")
30-
# keep CONDUIT_USE_CXX11 to support old install logic
31-
set(CONDUIT_USE_CXX11 "@CONDUIT_USE_CXX11@")
32-
set(CONDUIT_USE_CXX14 "@CONDUIT_USE_CXX14@")
33-
set(CONDUIT_USE_FMT "@CONDUIT_USE_FMT@")
34-
set(CONDUIT_USE_CALIPER "@CONDUIT_USE_CALIPER@")
35-
set(CONDUIT_USE_OPENMP "@ENABLE_OPENMP@")
36-
set(CONDUIT_INSTALL_PREFIX "@CONDUIT_INSTALL_PREFIX@")
37-
set(CONDUIT_ZLIB_DIR "@ZLIB_DIR@")
38-
set(CONDUIT_HDF5_DIR "@HDF5_DIR@")
39-
set(CONDUIT_ADIOS_DIR "@ADIOS_DIR@")
40-
set(CONDUIT_SILO_DIR "@SILO_DIR@")
41-
set(CONDUIT_METIS_DIR "@METIS_DIR@")
42-
set(CONDUIT_PARMETIS_DIR "@PARMETIS_DIR@")
43-
set(CONDUIT_ADIAK_DIR "@ADIAK_DIR@")
44-
set(CONDUIT_CALIPER_DIR "@CALIPER_DIR@")
45-
set(CONDUIT_PYTHON_ENABLED "@PYTHON_FOUND@")
46-
set(CONDUIT_PYTHON_EXECUTABLE "@PYTHON_EXECUTABLE@")
47-
set(CONDUIT_PYTHON_MODULE_DIR "@CONDUIT_INSTALL_PYTHON_MODULE_DIR@")
48-
set(CONDUIT_PYTHON_MODULE_CUSTOM_PREFIX "@CONDUIT_INSTALL_PYTHON_MODULE_CUSTOM_PREFIX@")
49-
set(CONDUIT_USE_CMAKE_MPI_TARGETS "@CONDUIT_USE_CMAKE_MPI_TARGETS@")
50-
51-
get_filename_component(CONDUIT_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
52-
53-
# setup dependent pkgs
54-
include(${CONDUIT_CMAKE_CONFIG_DIR}/conduit_setup_deps.cmake)
55-
56-
# include targets exported by cmake
57-
include(${CONDUIT_CMAKE_CONFIG_DIR}/conduit.cmake)
58-
59-
# finally setup our final imported targets
60-
include(${CONDUIT_CMAKE_CONFIG_DIR}/conduit_setup_targets.cmake)
61-
62-
set(Conduit_FOUND TRUE)
63-
64-
set(_conduit_known_components
65-
MPI)
66-
foreach(_conduit_component IN LISTS Conduit_FIND_COMPONENTS)
67-
if (NOT _conduit_component IN_LIST _conduit_known_components)
68-
set("Conduit_${_conduit_component}_FOUND" 0)
69-
set("Conduit_${_conduit_component}_NOT_FOUND_MESSAGE"
70-
"Unknown component ${_conduit_component}")
71-
72-
if(Conduit_FIND_REQUIRED_${_conduit_component})
73-
set(Conduit_FOUND 0)
74-
list(APPEND Conduit_NOT_FOUND_MESSAGE
75-
"Unknown component ${_conduit_component}")
76-
endif()
77-
else()
78-
if(NOT DEFINED Conduit_${_conduit_component}_FOUND)
79-
set("Conduit_${_conduit_component}_FOUND" 0)
80-
set("Conduit_${_conduit_component}_NOT_FOUND_MESSAGE"
81-
"Component ${_conduit_component} was not found (unimplemented?)")
82-
endif()
83-
if(NOT Conduit_${_conduit_component}_FOUND AND
84-
Conduit_FIND_REQUIRED_${_conduit_component})
85-
set(Conduit_FOUND 0)
86-
list(APPEND Conduit_NOT_FOUND_MESSAGE
87-
"Component ${_conduit_component} was not found: ${Conduit_${_conduit_component}_NOT_FOUND_MESSAGE}")
88-
endif()
89-
endif()
90-
endforeach()
91-
unset(_conduit_known_components)
92-
unset(_conduit_component)
93-
94-
set(CONDUIT_FOUND "${Conduit_FOUND}")
95-
96-
endif()
97-
92+
set(CONDUIT_FOUND "${Conduit_FOUND}")

0 commit comments

Comments
 (0)