Commit Graph

162 Commits

Author SHA1 Message Date
Atri Bhattacharya
a869b79c59 FindHDF5: Prefer h5hl* compilers for HDF5_FIND_HL
Prefer `h5hlcc`, `h5hlc++`, and `h5hlfc` compilers when HDF5's HL libraries
are requested. These include the `-lhdf_hl` in the command line, whereas
the non-hl compilers (like `h5cc`) do not. Using the latter, therefore,
leads to cmake complaining about not finding the `HDF5_HL` libraries even
though they are present in the same location as the `hdf5` library itself.

Fixes: #23261
2025-03-10 11:53:01 -04:00
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Brad King
7afa58b15d Modules/Find*: Include FindPackageHandleStandardArgs normally
Since commit d74210a8bd (CMP0017: Remove support for OLD behavior,
2024-11-17) we can rely on CMP0017's NEW behavior unconditionally.
Calling `include(FindPackageHandleStandardArgs)` in a builtin module
will always get the builtin `FindPackageHandleStandardArgs`.
2025-01-30 08:53:12 -05:00
Brad King
c283aafe62 CMP0057: Remove support for OLD behavior 2025-01-22 10:40:53 -05:00
Mark Abraham
3137faae6f FindHDF5: Avoid mentioning empty version when not found
Previously the not-found message confusingly mentioned an empty version
number:

    -- Could NOT find HDF5: Found unsuitable version "", ...

Don't confuse FindPackageHandleStandardArgs by defining an empty
version.
2024-09-18 10:55:11 -04:00
Brad King
80d285c080 Merge topic 'FindHDF5-version-4-components'
928943f91b FindHDF5: Fix detection of versions with more than three components

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9476
2024-05-01 09:16:20 -04:00
مهدي شينون (Mehdi Chinoune)
928943f91b FindHDF5: Fix detection of versions with more than three components
Fix detecting the version of HDF5 1.14.4.2.

Fixes: #25945
2024-04-30 11:22:41 -04:00
Juan Ramos
3cd64287fe Modules: Fix CMP0159 warnings in modules when tracing
Closes: #25829
2024-03-29 13:51:59 -07:00
Brad King
ee075a53c8 FindHDF5: Record compiler wrapper checks to configure log 2023-03-29 17:18:29 -04:00
Brad King
72915b1068 FindHDF5: Fix compiler wrapper checks with spaces in path
Some HDF5 compiler wrappers do not support source file paths that
contain spaces.  Pass source files to them using a file name in the
current working directory to avoid spaces.
2023-03-29 17:18:29 -04:00
Brad King
7ef184f726 Merge topic 'FindHDF5-CXX-without-C'
a6bb4975ab FindHDF5: Restore parallel HDF5 detection with only CXX enabled

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8355
2023-03-23 08:42:54 -04:00
Brad King
a6bb4975ab FindHDF5: Restore parallel HDF5 detection with only CXX enabled
Since commit 14c46fb16a (FindHDF5: Find C component with only CXX
compiler, 2022-12-13, v3.26.0-rc1~175^2), if CXX is enabled but C is
not, the `_HDF5_test_regular_compiler_C` helper writes a `.cpp` source
but the `_HDF5_invoke_compiler` still expects a `.c` source.  Refactor
the logic to select a name for the source file up front, and use it in
both helpers.

Fixes: #24627
Issue: #24241
2023-03-22 11:50:18 -04:00
Weiqun Zhang
18c2970a97 FindHDF5: Fix detection of Parallel HDF5
To detect Parallel HDF5, the output of `h5pcc -showconfig` was compared
with `Parallel HDF5: yes`.  However, the Boolean flag is not always
`yes` or `no`, because it was set by the value in `HDF5_ENABLE_PARALLEL`
if CMake was used for the configuration.  This commit instead checks to
see if the value is interpreted by CMake as "true".
2023-02-21 12:29:28 -08:00
Christoph Junghans
14c46fb16a 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
2022-12-14 10:00:51 -07:00
Matthew Woehlke
2edf0fc6d7 Modules: Use new keyword-dispatched try_compile signature
Modify most of the modules that ship with CMake to use the new
try_compile / try_run signatures added by commit aa9220d3a0
(try_compile: Add keyword-dispatched signature, 2022-09-02). This
improves debugging by each invocation using its own directory so that
the results of multiple invocations can be retained.

This does not cover any invocations which provide an entire project, as
that flavor of try_compile has not yet been updated.
2022-09-14 07:52:16 -04:00
Brad King
b5bc72574e FindHDF5: Revert "Add explicit library location instead of guessed ..."
Revert commit e4e309f165 (FindHDF5: Add explicit library location
instead of guessed library name., 2022-03-22, v3.24.0-rc1~375^2).
The old behavior was not a guessed library name, but the name of an
imported target that can contain per-config locations and encode usage
requirements.  Although find modules do not normally return their
imported target names in the `_LIBRARIES` variable, FindHDF5 has done so
since commit 5201a3065b (FindHDF5: use the target rather than the path,
2017-01-04, v3.8.0-rc1~81^2).

Fixes: #23667
2022-06-27 13:51:33 -04:00
مهدي شينون (Mehdi Chinoune)
e4e309f165 FindHDF5: Add explicit library location instead of guessed library name. 2022-03-22 17:09:28 +01:00
Axel Huebl
449f343498 FindHDF5: Tolerate failure during compiler interrogation
Check that the file that is accessed via `file(STRINGS...)` truly
exists.

This is not the case in some EMSCRIPTEN/WebASM builds where we want to
overwrite the HDF5 find logic manually. The missing check here prevents
that one can overwrite the search logic in exotic environments.
2022-02-15 10:44:29 -05:00
Brad King
db9d911db0 FindHDF5: Set config-specific locations for imported targets
Update the imported target locations added by commit a8e0a6b3e4
(FindHDF5: Port changes from VTK, 2020-06-10, v3.19.0-rc1~312^2~1) to
use config-specific locations.

Issue: #21637
2022-01-31 17:42:39 -05:00
Brad King
d28e5263fe FindHDF5: Drop IMPORTED_IMPLIB property from imported UNKNOWN libraries
The imported targets added by commit a8e0a6b3e4 (FindHDF5: Port changes
from VTK, 2020-06-10, v3.19.0-rc1~312^2~1) to use config-specific
locations set the `IMPORTED_IMPLIB` target property.  That property has
no meaning for an imported library with type `UNKNOWN`.  Drop it to
avoid confusion.
2022-01-31 17:16:37 -05:00
Håkon Strandenes
86c697f49a FindHDF5: Fix Fortran compiler interrogation without HL library
When the HDF5 HL library is not available, FindHDF5 with Fortran does
not work.  The problem is because `cmake_hdf5_test.f90` tries to
"use h5lt" and "use h5ds", which comes from the HL library.
Then the basic compiler check fails completely.

The two "use" lines were added by commit 00405af0f1 (HDF5: Refactor the
use of compiler wrappers, 2016-04-04, v3.6.0-rc1~85^2) along with the
rest of the check.  Remove them.

Fixes: #22890
2021-11-17 09:22:41 -05:00
Brad King
e0bb15abfd Merge topic 'FindHDF5-avoid-duplicate-library-entries'
247f1149e1 FindHDF5: clear language-specific libraries list before discovery
f56963cf05 FindHDF5: clear library output variables at the top of the module

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6698
2021-11-04 09:06:40 -04:00
Brad King
52e1ff3315 Merge topic 'FindHDF5-fix-windows-hl-implib-query'
6f830c5c38 FindHDF5: fix variable name when querying `hdf5_hl`'s implib

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6697
2021-11-04 09:04:42 -04:00
Ben Boeckel
247f1149e1 FindHDF5: clear language-specific libraries list before discovery 2021-11-03 13:24:30 -04:00
Ben Boeckel
f56963cf05 FindHDF5: clear library output variables at the top of the module
This avoids accumulation of `HDF5_LIBRARIES` results when calling
`find_package(HDF5)` multiple times within a single scope.
2021-11-03 13:05:18 -04:00
Ben Boeckel
6f830c5c38 FindHDF5: fix variable name when querying hdf5_hl's implib
Introduced in 4150048a3b (FindHDF5: unset some variables, 2017-07-24).
2021-11-03 11:29:20 -04:00
makise-homura
e5d9fce03f LCC: Add dedicated support for MCST LCC compiler
Divert LCC compiler as a new one, instead of treating it as GNU.

Since old times, Elbrus C/C++/Fortran Compiler (LCC) by MCST has been
passing checks for GNU compilers, so it has been identified as GNU.
Now, with intent of seriously upstreaming its support, it has been
added as a separate LCC compiler, and its version displays not a
supported GCC version, but LCC version itself (e.g. LCC 1.25.19 instead
of GNU 7.3.0).

This commit adds its support for detection, and also converts basically
every check like 'is this compiler GNU?' to 'is this compiler GNU or
LCC?'. The only places where this check is untouched, is where it
regards other platforms where LCC is unavailable (primarily non-Linux),
and where it REALLY differs from GNU compiler.

Note: this transition may break software that are already ported to
Elbrus, but hardly relies that LCC will be detected as GNU; still such
software is not known.
2021-10-15 05:05:19 +03:00
Ben Boeckel
cd48433e96 FindHDF5: add compiler-specific module search paths 2021-04-06 08:36:31 -04:00
Ben Boeckel
78287ec0af FindHDF5: track the "main" library for each language
This will be used to build up additional include paths to search.
2021-04-06 08:36:31 -04:00
Ben Boeckel
3654068e80 FindHDF5: find include directories after the library
Some include paths might depend on the library location (primarily for
Fortran).
2021-04-06 08:36:31 -04:00
Ben Boeckel
ff84a80b46 FindHDF5: search for the new Fortran HL library name
HDF5 1.10.6 renamed this library to match the other language binding
library names.

Fixes: #20205
2021-04-05 11:56:50 -04:00
Brad King
89430f4604 Merge topic 'FindHDF5-silence-output'
b924669385 FindHDF5: silence STATUS messages when found with QUIET
2439a048b0 FindHDF5: avoid writing to the output when testing h5cc

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5722
2021-01-21 09:17:39 -05:00
Ben Boeckel
b924669385 FindHDF5: silence STATUS messages when found with QUIET 2021-01-20 14:05:14 -05:00
Ben Boeckel
2439a048b0 FindHDF5: avoid writing to the output when testing h5cc
The execution of this tool can output error logs to the output during
configure. This can then be caught by CTest and flagged as an error
during the build.
2021-01-20 14:04:25 -05:00
Brad King
b9b5d49284 Merge topic 'FindHDF5-no-dedup-keywords'
a5fe1712b2 FindHDF5: Remove unnecessary de-duplication of HDF5_LIBRARIES and friends
dadb13f546 FindHDF5: Simplify preprocessor setting de-duplication

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5692
2021-01-15 10:29:36 -05:00
Kris Thielemans
a5fe1712b2 FindHDF5: Remove unnecessary de-duplication of HDF5_LIBRARIES and friends
* When both debug and optimized libraries are found, the corresponding
  keywords were getting de-duplicated and breaking.
* CMake's link line generation de-duplicates in many cases anyway.
* Other find modules do not explicitly de-duplicate in general.

Fixes: #21670
2021-01-12 16:26:59 -05:00
Brad King
dadb13f546 FindHDF5: Simplify preprocessor setting de-duplication
Use `list(REMOVE_DUPLICATES)` directly.  For definitions the order
doesn't matter.  For include directories it is better to remove late
duplicates than early duplicates.
2021-01-12 16:24:25 -05:00
Kris Thielemans
eec3b775a7 FindHDF5: List imported targets in debug output
If HDF5_FIND_DEBUG, list all targets that are defined
(from either FindHDF5.cmake or the hdf5-config.cmake).
2021-01-11 12:00:38 -05:00
Kris Thielemans
186b0f8131 FindHDF5: correct and describe list of imported target 2021-01-11 12:00:14 -05:00
Brad King
3734a96d98 Merge topic 'FindHDF5-dbg-and-rel'
5267ba9d63 FindHDF5: Fix finding both debug and release libs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5653
2021-01-06 14:08:27 -05:00
Kris Thielemans
5267ba9d63 FindHDF5: Fix finding both debug and release libs
Use `target_link_libraries` to set `INTERFACE_LINK_LIBRARIES` so that
the `debug` and `optimized` keywords work.

In commit a8e0a6b3e4 (FindHDF5: Port changes from VTK, 2020-06-10,
v3.19.0-rc1~312^2~1) we added use of `HDF5_LIBRARIES`, but the value may
contain `debug` and `optimized` keywords.

Fixes: #21637
2021-01-04 14:26:38 -05:00
Brad King
0eead931a3 Merge topic 'versionadded'
5000f93a91 Help: Fix grammar in `.. versionadded` directives
8fea95319b Help: Add `.. versionadded` directives to module docs
8634561dca Help: Improve formatting for FindBoost and FindCUDA
ea59b0cd34 Help: Fix version note for CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE
05c3060b10 Help: Fix cmake_parse_arguments version note
dafcef8b50 Help: Improve styling for versionadded/deprecated directives
6ae216daef Tests: Make RunCMake.CMP0106 expected output robust to line number changes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5560
2020-12-03 08:49:25 -05:00
Nikita Nemkin
8fea95319b Help: Add .. versionadded directives to module docs
Issue: #19715
2020-12-02 21:00:30 +05:00
Ben Boeckel
175beadd4c FindHDF5: support the hdf5hl_fortran-based variable names
Fixes: #21537
2020-12-01 15:31:47 -05:00
Ben Boeckel
adf108441e FindHDF5: improve error messages when a location variable isn't known 2020-12-01 15:31:21 -05:00
Seth R Johnson
5eff274017 FindHDF5: Remove VTK library type detection 2020-08-14 12:03:21 -04:00
Ben Boeckel
a8e0a6b3e4 FindHDF5: Port changes from VTK 2020-08-14 11:57:59 -04:00
Brad King
b995e2db38 Merge topic 'findhdf5-fix-nohl'
e038107ee7 FindHDF5: fix compiler detection when HL is disabled

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5112
2020-08-11 08:55:46 -04:00
Seth R Johnson
e038107ee7 FindHDF5: fix compiler detection when HL is disabled
A valid HDF5 installation with the "high level" extensions not
configured will *fail* to be correctly detected by CMake since
commit d9e39f3f89 (FindHDF5: check that compiler wrapper can
compile a minimal program, 2020-02-10, v3.18.0-rc1~744^2~1):

```
/.../hdf5/cmake_hdf5_test.c:2:10: fatal error: 'hdf5_hl.h' file not found
```

This does not stop the configuration but does prevent flags and
libraries from being recognized.
2020-08-10 11:53:58 -04:00
Seth R Johnson
931492bd6f FindHDF5: use CMakeFiles for temporary files 2020-06-11 13:47:47 -04:00