Merge topic 'ci-FindHDF5'

d38c752de2 ci: Enable FindHDF5 tests on Linux builds
28c4945a8a ci: Add HDF5 to Debian and Fedora base images
ad9e151045 Tests: Add cases covering FindHDF5 variables and imported targets
0e87e6c1a4 Tests: Add FindMPI test environment modification option
ee075a53c8 FindHDF5: Record compiler wrapper checks to configure log
72915b1068 FindHDF5: Fix compiler wrapper checks with spaces in path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8378
This commit is contained in:
Brad King
2023-03-30 11:22:11 +00:00
committed by Kitware Robot
13 changed files with 234 additions and 23 deletions
@@ -25,6 +25,22 @@ set(CMake_TEST_FindGnuTLS "ON" CACHE BOOL "")
set(CMake_TEST_FindGSL "ON" CACHE BOOL "")
set(CMake_TEST_FindGTest "ON" CACHE BOOL "")
set(CMake_TEST_FindGTK2 "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5 "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5_MPICH_C_COMPILER "/usr/bin/h5pcc.mpich" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_MPICH_C_COMPILER_EXPLICIT "ON" CACHE BOOL "")
# set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER "/usr/bin/h5c++.mpich" CACHE FILEPATH "") # h5c++.mpich does not exist
# set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER_EXPLICIT "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5_MPICH_Fortran_COMPILER "/usr/bin/h5pfc.mpich" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_MPICH_Fortran_COMPILER_EXPLICIT "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5_OpenMPI_C_COMPILER "/usr/bin/h5pcc.openmpi" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_OpenMPI_C_COMPILER_EXPLICIT "ON" CACHE BOOL "")
# set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER "/usr/bin/h5c++.openmpi" CACHE FILEPATH "") # h5c++.openmpi does not exist
# set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER_EXPLICIT "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5_OpenMPI_Fortran_COMPILER "/usr/bin/h5pfc.openmpi" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_OpenMPI_Fortran_COMPILER_EXPLICIT "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5_Serial_C_COMPILER "/usr/bin/h5cc" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_Serial_CXX_COMPILER "/usr/bin/h5c++" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_Serial_Fortran_COMPILER "/usr/bin/h5fc" CACHE FILEPATH "")
set(CMake_TEST_FindIconv "ON" CACHE BOOL "")
set(CMake_TEST_FindICU "ON" CACHE BOOL "")
set(CMake_TEST_FindImageMagick "ON" CACHE BOOL "")
+16
View File
@@ -29,6 +29,22 @@ set(CMake_TEST_FindGnuTLS "ON" CACHE BOOL "")
set(CMake_TEST_FindGSL "ON" CACHE BOOL "")
set(CMake_TEST_FindGTest "ON" CACHE BOOL "")
set(CMake_TEST_FindGTK2 "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5 "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5_MPICH_C_COMPILER "/usr/bin/h5pcc.mpich" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_MPICH_C_COMPILER_EXPLICIT "ON" CACHE BOOL "")
# set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER "/usr/bin/h5c++.mpich" CACHE FILEPATH "") # h5c++.mpich does not exist
# set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER_EXPLICIT "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5_MPICH_Fortran_COMPILER "/usr/bin/h5pfc.mpich" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_MPICH_Fortran_COMPILER_EXPLICIT "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5_OpenMPI_C_COMPILER "/usr/bin/h5pcc.openmpi" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_OpenMPI_C_COMPILER_EXPLICIT "ON" CACHE BOOL "")
# set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER "/usr/bin/h5c++.openmpi" CACHE FILEPATH "") # h5c++.openmpi does not exist
# set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER_EXPLICIT "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5_OpenMPI_Fortran_COMPILER "/usr/bin/h5pfc.openmpi" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_OpenMPI_Fortran_COMPILER_EXPLICIT "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5_Serial_C_COMPILER "/usr/bin/h5cc" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_Serial_CXX_COMPILER "/usr/bin/h5c++" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_Serial_Fortran_COMPILER "/usr/bin/h5fc" CACHE FILEPATH "")
set(CMake_TEST_FindIconv "ON" CACHE BOOL "")
set(CMake_TEST_FindICU "ON" CACHE BOOL "")
set(CMake_TEST_FindImageMagick "ON" CACHE BOOL "")
@@ -28,6 +28,18 @@ set(CMake_TEST_FindGnuTLS "ON" CACHE BOOL "")
set(CMake_TEST_FindGSL "ON" CACHE BOOL "")
set(CMake_TEST_FindGTest "ON" CACHE BOOL "")
set(CMake_TEST_FindGTK2 "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5 "ON" CACHE BOOL "")
set(CMake_TEST_FindHDF5_MPICH_C_COMPILER "/usr/lib64/mpich/bin/h5pcc" CACHE FILEPATH "")
# set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER "/usr/lib64/mpich/bin/h5pc++" CACHE FILEPATH "") # h5pc++ does not exist
set(CMake_TEST_FindHDF5_MPICH_ENVMOD "PATH=path_list_prepend:/usr/lib64/mpich/bin;LD_LIBRARY_PATH=path_list_prepend:/usr/lib64/mpich/lib" CACHE STRING "")
set(CMake_TEST_FindHDF5_MPICH_Fortran_COMPILER "/usr/lib64/mpich/bin/h5pfc" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_OpenMPI_C_COMPILER "/usr/lib64/openmpi/bin/h5pcc" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_OpenMPI_ENVMOD "PATH=path_list_prepend:/usr/lib64/openmpi/bin;LD_LIBRARY_PATH=path_list_prepend:/usr/lib64/openmpi/lib" CACHE STRING "")
# set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER "/usr/lib64/openmpi/bin/h5pc++" CACHE FILEPATH "") # h5pc++ does not exist
# set(CMake_TEST_FindHDF5_OpenMPI_Fortran_COMPILER "/usr/lib64/openmpi/bin/h5pfc" CACHE FILEPATH "") # cannot find its own hdf5.mod
set(CMake_TEST_FindHDF5_Serial_C_COMPILER "/usr/bin/h5cc" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_Serial_CXX_COMPILER "/usr/bin/h5c++" CACHE FILEPATH "")
set(CMake_TEST_FindHDF5_Serial_Fortran_COMPILER "/usr/bin/h5fc" CACHE FILEPATH "")
set(CMake_TEST_FindIconv "ON" CACHE BOOL "")
set(CMake_TEST_FindICU "ON" CACHE BOOL "")
set(CMake_TEST_FindImageMagick "ON" CACHE BOOL "")
@@ -45,6 +57,7 @@ set(CMake_TEST_FindLibXslt "ON" CACHE BOOL "")
set(CMake_TEST_FindMPI_C "ON" CACHE BOOL "")
set(CMake_TEST_FindMPI_CXX "ON" CACHE BOOL "")
set(CMake_TEST_FindMPI_Fortran "ON" CACHE BOOL "")
set(CMake_TEST_FindMPI_ENVMOD "PATH=path_list_prepend:/usr/lib64/mpich/bin;LD_LIBRARY_PATH=path_list_prepend:/usr/lib64/mpich/lib" CACHE STRING "")
set(CMake_TEST_FindMPI "ON" CACHE BOOL "")
set(CMake_TEST_FindODBC "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenACC "ON" CACHE BOOL "")
@@ -59,6 +59,9 @@ libgrpc++-dev libgrpc-dev
libgsl-dev
libgtest-dev
libgtk2.0-dev
libhdf5-dev
libhdf5-mpich-dev
libhdf5-openmpi-dev
libicu-dev
libinput-dev
libjpeg-dev
@@ -62,6 +62,9 @@ libgrpc++-dev libgrpc-dev
libgsl-dev
libgtest-dev
libgtk2.0-dev
libhdf5-dev
libhdf5-mpich-dev
libhdf5-openmpi-dev
libicu-dev
libinput-dev
libjpeg-dev
@@ -73,6 +73,9 @@ grpc-devel grpc-plugins
gsl-devel
gtest-devel
gtk2-devel
hdf5-devel
hdf5-mpich-devel
hdf5-openmpi-devel
ImageMagick-c++-devel
java-11-openjdk-devel
jsoncpp-devel
-1
View File
@@ -1,2 +1 @@
set(ENV{MY_RUBY_HOME} "/usr/local/rvm/rubies/ruby-3.0.4")
set(ENV{PATH} "/usr/lib64/mpich/bin:$ENV{PATH}")
+3 -3
View File
@@ -45,7 +45,7 @@
### Debian
.debian10:
image: "kitware/cmake:ci-debian10-x86_64-2023-03-08"
image: "kitware/cmake:ci-debian10-x86_64-2023-03-29"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
@@ -60,7 +60,7 @@
CMAKE_CI_NO_INSTALL: 1
.debian10_aarch64:
image: "kitware/cmake:ci-debian10-aarch64-2023-03-08"
image: "kitware/cmake:ci-debian10-aarch64-2023-03-29"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
@@ -69,7 +69,7 @@
### Fedora
.fedora37:
image: "kitware/cmake:ci-fedora37-x86_64-2023-03-08"
image: "kitware/cmake:ci-fedora37-x86_64-2023-03-29"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes"
+31 -19
View File
@@ -219,7 +219,7 @@ endif()
function(_HDF5_test_regular_compiler_C success version is_parallel)
if(NOT ${success} OR
NOT EXISTS ${_HDF5_TEST_DIR}/compiler_has_h5_c)
file(WRITE "${_HDF5_TEST_SRC}"
file(WRITE "${_HDF5_TEST_DIR}/${_HDF5_TEST_SRC}"
"#include <hdf5.h>\n"
"const char* info_ver = \"INFO\" \":\" H5_VERSION;\n"
"#ifdef H5_HAVE_PARALLEL\n"
@@ -235,7 +235,7 @@ function(_HDF5_test_regular_compiler_C success version is_parallel)
" fid = H5Fcreate(\"foo.h5\",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);\n"
" return 0;\n"
"}")
try_compile(${success} SOURCES "${_HDF5_TEST_SRC}"
try_compile(${success} SOURCES "${_HDF5_TEST_DIR}/${_HDF5_TEST_SRC}"
COPY_FILE ${_HDF5_TEST_DIR}/compiler_has_h5_c
)
endif()
@@ -263,7 +263,7 @@ endfunction()
function(_HDF5_test_regular_compiler_CXX success version is_parallel)
if(NOT ${success} OR
NOT EXISTS ${_HDF5_TEST_DIR}/compiler_has_h5_cxx)
file(WRITE "${_HDF5_TEST_SRC}"
file(WRITE "${_HDF5_TEST_DIR}/${_HDF5_TEST_SRC}"
"#include <H5Cpp.h>\n"
"#ifndef H5_NO_NAMESPACE\n"
"using namespace H5;\n"
@@ -281,7 +281,7 @@ function(_HDF5_test_regular_compiler_CXX success version is_parallel)
" H5File file(\"foo.h5\", H5F_ACC_TRUNC);\n"
" return 0;\n"
"}")
try_compile(${success} SOURCES "${_HDF5_TEST_SRC}"
try_compile(${success} SOURCES "${_HDF5_TEST_DIR}/${_HDF5_TEST_SRC}"
COPY_FILE ${_HDF5_TEST_DIR}/compiler_has_h5_cxx
)
endif()
@@ -308,14 +308,14 @@ endfunction()
function(_HDF5_test_regular_compiler_Fortran success is_parallel)
if(NOT ${success})
file(WRITE "${_HDF5_TEST_SRC}"
file(WRITE "${_HDF5_TEST_DIR}/${_HDF5_TEST_SRC}"
"program hdf5_hello\n"
" use hdf5\n"
" integer error\n"
" call h5open_f(error)\n"
" call h5close_f(error)\n"
"end\n")
try_compile(${success} SOURCES "${_HDF5_TEST_SRC}")
try_compile(${success} SOURCES "${_HDF5_TEST_DIR}/${_HDF5_TEST_SRC}")
if(${success})
execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -showconfig
OUTPUT_VARIABLE config_output
@@ -356,9 +356,13 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var
ERROR_VARIABLE output
RESULT_VARIABLE return_value
)
if(return_value AND NOT HDF5_FIND_QUIETLY)
message(STATUS
"HDF5 ${language} compiler wrapper is unable to compile a minimal HDF5 program.")
if(NOT return_value EQUAL 0)
message(CONFIGURE_LOG
"HDF5 ${language} compiler wrapper is unable to compile a minimal HDF5 program.\n\n${output}")
if(NOT HDF5_FIND_QUIETLY)
message(STATUS
"HDF5 ${language} compiler wrapper is unable to compile a minimal HDF5 program.")
endif()
else()
execute_process(
COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} -show ${lib_type_args} "${_HDF5_TEST_SRC}"
@@ -368,9 +372,13 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var
RESULT_VARIABLE return_value
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(return_value AND NOT HDF5_FIND_QUIETLY)
message(STATUS
"Unable to determine HDF5 ${language} flags from HDF5 wrapper.")
if(NOT return_value EQUAL 0)
message(CONFIGURE_LOG
"Unable to determine HDF5 ${language} flags from HDF5 wrapper.\n\n${output}")
if(NOT HDF5_FIND_QUIETLY)
message(STATUS
"Unable to determine HDF5 ${language} flags from HDF5 wrapper.")
endif()
endif()
execute_process(
COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} -showconfig
@@ -379,9 +387,13 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var
RESULT_VARIABLE return_value
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(return_value AND NOT HDF5_FIND_QUIETLY)
message(STATUS
"Unable to determine HDF5 ${language} version_var from HDF5 wrapper.")
if(NOT return_value EQUAL 0)
message(CONFIGURE_LOG
"Unable to determine HDF5 ${language} version_var from HDF5 wrapper.\n\n${output}")
if(NOT HDF5_FIND_QUIETLY)
message(STATUS
"Unable to determine HDF5 ${language} version_var from HDF5 wrapper.")
endif()
endif()
string(REGEX MATCH "HDF5 Version: ([a-zA-Z0-9\\.\\-]*)" version "${config_output}")
if(version)
@@ -588,23 +600,23 @@ if(NOT HDF5_FOUND)
# First check to see if our regular compiler is one of wrappers
if(_lang STREQUAL "C")
set(_HDF5_TEST_SRC ${_HDF5_TEST_DIR}/cmake_hdf5_test.c)
set(_HDF5_TEST_SRC cmake_hdf5_test.c)
if(CMAKE_CXX_COMPILER_LOADED AND NOT CMAKE_C_COMPILER_LOADED)
# CXX project without C enabled
set(_HDF5_TEST_SRC ${_HDF5_TEST_DIR}/cmake_hdf5_test.cxx)
set(_HDF5_TEST_SRC cmake_hdf5_test.cxx)
endif()
_HDF5_test_regular_compiler_C(
HDF5_${_lang}_COMPILER_NO_INTERROGATE
HDF5_${_lang}_VERSION
HDF5_${_lang}_IS_PARALLEL)
elseif(_lang STREQUAL "CXX")
set(_HDF5_TEST_SRC ${_HDF5_TEST_DIR}/cmake_hdf5_test.cxx)
set(_HDF5_TEST_SRC cmake_hdf5_test.cxx)
_HDF5_test_regular_compiler_CXX(
HDF5_${_lang}_COMPILER_NO_INTERROGATE
HDF5_${_lang}_VERSION
HDF5_${_lang}_IS_PARALLEL)
elseif(_lang STREQUAL "Fortran")
set(_HDF5_TEST_SRC ${_HDF5_TEST_DIR}/cmake_hdf5_test.f90)
set(_HDF5_TEST_SRC cmake_hdf5_test.f90)
_HDF5_test_regular_compiler_Fortran(
HDF5_${_lang}_COMPILER_NO_INTERROGATE
HDF5_${_lang}_IS_PARALLEL)
+1
View File
@@ -1450,6 +1450,7 @@ if(BUILD_TESTING)
GnuTLS
GSL
GTK2
HDF5
Iconv
ICU
ImageMagick
+84
View File
@@ -0,0 +1,84 @@
# These tests may be configured by cache entries:
#
# CMake_TEST_FindHDF5:BOOL=ON
# Enable this directory.
#
# CMake_TEST_FindHDF5_<variant>_<lang>_COMPILER:FILEPATH=...
# Enable testing for a variant/language combination with the given wrapper.
# Variants: Serial, OpenMPI, MPICH
# Languages: C, CXX, Fortran
#
# CMake_TEST_FindHDF5_<variant>_<lang>_COMPILER_EXPLICIT:BOOL=ON
# Pass the above wrapper path to the test as HDF5_<lang>_COMPILER_EXECUTABLE.
set(test_langs C CXX)
if(CMAKE_Fortran_COMPILER)
list(APPEND test_langs Fortran)
endif()
# Test detection without any special hints.
add_test(NAME FindHDF5.Default COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindHDF5/Test"
"${CMake_BINARY_DIR}/Tests/FindHDF5/Test-Default"
${build_generator_args}
--build-project TestFindHDF5
--build-options ${build_options} -DTEST_SERIAL=1 "-DTEST_LANGS=${test_langs}"
)
foreach(variant Serial OpenMPI MPICH)
set(wrapper "")
set(wrapper_langs "")
set(wrapper_as_compiler "")
foreach(lang IN LISTS test_langs)
if(CMake_TEST_FindHDF5_${variant}_${lang}_COMPILER)
list(APPEND wrapper_langs ${lang})
list(APPEND wrapper_as_compiler -DCMAKE_${lang}_COMPILER=${CMake_TEST_FindHDF5_${variant}_${lang}_COMPILER})
if(CMake_TEST_FindHDF5_${variant}_${lang}_COMPILER_EXPLICIT)
list(APPEND wrapper -DHDF5_${lang}_COMPILER_EXECUTABLE=${CMake_TEST_FindHDF5_${variant}_${lang}_COMPILER})
endif()
endif()
endforeach()
if(NOT wrapper_langs)
continue()
endif()
if(variant STREQUAL "Serial")
set(test_kind -DTEST_SERIAL=1)
else()
set(test_kind -DTEST_PARALLEL=1)
endif()
# Test detection using the HDF5 compiler wrappers as a reference.
add_test(NAME FindHDF5.${variant} COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindHDF5/Test"
"${CMake_BINARY_DIR}/Tests/FindHDF5/Test-${variant}"
${build_generator_args}
--build-project TestFindHDF5
--build-options ${build_options} ${test_kind} "-DTEST_LANGS=${wrapper_langs}" ${wrapper}
)
if(CMake_TEST_FindHDF5_${variant}_ENVMOD)
set_property(TEST FindHDF5.${variant} PROPERTY ENVIRONMENT_MODIFICATION ${CMake_TEST_FindHDF5_${variant}_ENVMOD})
endif()
# Test detection using the HDF5 compiler wrappers as the compiler.
# Skip this if there are spaces in the path. The HDF5 wrappers do not like them.
if(NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ")
add_test(NAME FindHDF5.${variant}-Wrapper COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindHDF5/Test"
"${CMake_BINARY_DIR}/Tests/FindHDF5/Test-${variant}-Wrapper"
${build_generator_args}
--build-project TestFindHDF5
--build-options ${build_options} ${test_kind} "-DTEST_LANGS=${wrapper_langs}" -D TEST_WRAPPER_AS_COMPILER=1 ${wrapper_as_compiler}
)
if(CMake_TEST_FindHDF5_${variant}_ENVMOD)
set_property(TEST FindHDF5.${variant}-Wrapper PROPERTY ENVIRONMENT_MODIFICATION ${CMake_TEST_FindHDF5_${variant}_ENVMOD})
endif()
endif()
endforeach()
+58
View File
@@ -0,0 +1,58 @@
cmake_minimum_required(VERSION 3.26)
project(TestFindHDF5 LANGUAGES ${TEST_LANGS})
message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
if(TEST_PARALLEL)
set(HDF5_PREFER_PARALLEL 1)
endif()
find_package(HDF5 REQUIRED COMPONENTS ${TEST_LANGS} HL)
set(variables HDF5_FOUND HDF5_VERSION)
if(NOT TEST_WRAPPER_AS_COMPILER)
list(APPEND variables HDF5_INCLUDE_DIRS HDF5_LIBRARIES HDF5_HL_LIBRARIES)
foreach(lang ${TEST_LANGS})
list(APPEND variables
HDF5_${lang}_COMPILER_EXECUTABLE
HDF5_${lang}_INCLUDE_DIRS
HDF5_${lang}_LIBRARIES
HDF5_${lang}_HL_LIBRARIES
)
endforeach()
endif()
foreach(var IN LISTS variables)
message(STATUS "${var}='${${var}}'")
endforeach()
foreach(var IN LISTS variables)
if(NOT DEFINED ${var})
message(SEND_ERROR "Variable '${var}' is not defined!")
endif()
endforeach()
set(targets HDF5::HDF5)
if(CMAKE_C_COMPILER_LOADED)
list(APPEND targets hdf5::hdf5 hdf5::hdf5_hl)
endif()
if(CMAKE_CXX_COMPILER_LOADED)
list(APPEND targets hdf5::hdf5_cpp hdf5::hdf5_hl_cpp)
endif()
if(CMAKE_Fortran_COMPILER_LOADED)
list(APPEND targets hdf5::hdf5_fortran hdf5::hdf5_hl_fortran)
endif()
foreach(target IN LISTS targets)
if(NOT TARGET ${target})
message(SEND_ERROR "Target '${target}' not defined!")
endif()
endforeach()
message(STATUS "HDF5_IS_PARALLEL='${HDF5_IS_PARALLEL}'")
if(TEST_SERIAL)
if(HDF5_IS_PARALLEL)
message(SEND_ERROR "HDF5_IS_PARALLEL is true in serial test.")
endif()
endif()
if(TEST_PARALLEL)
if(NOT HDF5_IS_PARALLEL)
message(SEND_ERROR "HDF5_IS_PARALLEL is false in parallel test.")
endif()
endif()
+3
View File
@@ -19,3 +19,6 @@ add_test(NAME FindMPI.Test COMMAND
-DMPI_TEST_Fortran=${CMake_TEST_FindMPI_FLAG_Fortran}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
if(CMake_TEST_FindMPI_ENVMOD)
set_property(TEST FindMPI.Test PROPERTY ENVIRONMENT_MODIFICATION ${CMake_TEST_FindMPI_ENVMOD})
endif()