diff options
author | Christoph Junghans <junghans@votca.org> | 2022-12-14 01:29:18 (GMT) |
---|---|---|
committer | Christoph Junghans <junghans@lanl.gov> | 2022-12-14 17:00:51 (GMT) |
commit | 14c46fb16a6c431e3b011d101d4d19f51ff8ad27 (patch) | |
tree | dc9bfd23dadb8aadd7677faaa46808fb148dcc24 /Modules/FindHDF5.cmake | |
parent | ff875ed8591afdb87055b8e43b1fcd04438a4d1e (diff) | |
download | CMake-14c46fb16a6c431e3b011d101d4d19f51ff8ad27.zip CMake-14c46fb16a6c431e3b011d101d4d19f51ff8ad27.tar.gz CMake-14c46fb16a6c431e3b011d101d4d19f51ff8ad27.tar.bz2 |
FindHDF5: Find C component with only CXX compiler
For CXX-only projects it is sometimes useful to detect the C
component even with just a CXX compiler.
Fixes: #24241
Diffstat (limited to 'Modules/FindHDF5.cmake')
-rw-r--r-- | Modules/FindHDF5.cmake | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index d662a7d..db03c54 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -222,6 +222,10 @@ function(_HDF5_test_regular_compiler_C success version is_parallel) if(NOT ${success} OR NOT EXISTS ${scratch_directory}/compiler_has_h5_c) set(test_file ${scratch_directory}/cmake_hdf5_test.c) + # CXX project without C enabled + if(CMAKE_CXX_COMPILER_LOADED AND NOT CMAKE_C_COMPILER_LOADED) + set(test_file ${scratch_directory}/cmake_hdf5_test.cpp) + endif() file(WRITE ${test_file} "#include <hdf5.h>\n" "const char* info_ver = \"INFO\" \":\" H5_VERSION;\n" |