Skip to content

FindHDF5: Clean variables and output

Seth R Johnson requested to merge sethrj/cmake:20718-clean-findhdf5 into master

See https://gitlab.kitware.com/sethrj/findhdf5-test for detailed history and demonstration of the module's functionality being preserved (and the changes doing what they say).

  • Unset local variables before leaving script
  • Change macros to functions
  • Fix return value check from execute_process
  • Hide status messages unless HDF5_FIND_DEBUG is enabled
  • Format some functions
  • Normalize TRUE/FALSE capitalization
Diff for local variables generated by find_package(HDF5 REQUIRED COMPONENTS C HL)
diff --git a/out.txt b/out.txt
index a2dcb93..fc15f81 100644
--- a/out.txt
+++ b/out.txt
@@ -1,8 +1,7 @@
 using custom HDF5
  - CMAKE_MODULE_PATH=/Users/s3j/_cmaketest/cmake
- - FIND_HL=ON
  - FIND_PACKAGE_MESSAGE_DETAILS_HDF5=[/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd/lib/libhdf5.dylib;/rnsdhpc/code/spack/opt/spack/clang/libszip/slsy6ko/lib/libsz.dylib;/rnsdhpc/code/spack/opt/spack/clang/zlib/xj36ejk/lib/libz.dylib;/usr/lib/libdl.dylib;/usr/lib/libm.dylib][/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd/lib/libhdf5_hl.dylib][cfound components: C HL ][v1.10.6()]
- - HDF5_COMPILER_NO_INTERROGATE=False
+ - HDF5_COMPILER_NO_INTERROGATE=FALSE
  - HDF5_CONSIDERED_CONFIGS=
  - HDF5_CONSIDERED_VERSIONS=
  - HDF5_CXX_COMPILER_NAMES=h5c++;h5pc++
@@ -10,8 +9,7 @@ using custom HDF5
  - HDF5_C_COMPILER_NO_INTERROGATE=FALSE
  - HDF5_C_COMPILE_LINE=/usr/bin/clang -I/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd/include -I/rnsdhpc/code/spack/opt/spack/clang/zlib/xj36ejk/include -I/rnsdhpc/code/spack/opt/spack/clang/libszip/slsy6ko/include -fPIC -c /Users/s3j/_cmaketest/build/CMakeFiles/hdf5/cmake_hdf5_test.c
 /usr/bin/clang -I/rnsdhpc/code/spack/opt/spack/clang/zlib/xj36ejk/include -I/rnsdhpc/code/spack/opt/spack/clang/libszip/slsy6ko/include -fPIC cmake_hdf5_test.o -L/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd/lib -lhdf5_hl -lhdf5 -L/rnsdhpc/code/spack/opt/spack/clang/zlib/xj36ejk/lib -L/rnsdhpc/code/spack/opt/spack/clang/libszip/slsy6ko/lib -lsz -lz -ldl -lm
-
- - HDF5_C_FOUND=True
+ - HDF5_C_FOUND=TRUE
  - HDF5_C_HL_LIBRARIES=/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd/lib/libhdf5_hl.dylib
  - HDF5_C_HL_LIBRARY_NAMES=hdf5_hl
  - HDF5_C_INCLUDE_DIRS=/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd/include;/rnsdhpc/code/spack/opt/spack/clang/zlib/xj36ejk/include;/rnsdhpc/code/spack/opt/spack/clang/libszip/slsy6ko/include
@@ -29,9 +27,10 @@ using custom HDF5
  - HDF5_C_VERSION=1.10.6
  - HDF5_DIFF_EXECUTABLE=/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd/bin/h5diff
  - HDF5_DIR=HDF5_DIR-NOTFOUND
+ - HDF5_FIND_HL=ON
  - HDF5_FOUND=TRUE
  - HDF5_Fortran_COMPILER_NAMES=h5fc;h5pfc
- - HDF5_HL_FOUND=True
+ - HDF5_HL_FOUND=TRUE
  - HDF5_HL_LIBRARIES=/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd/lib/libhdf5_hl.dylib
  - HDF5_INCLUDE_DIR=/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd/include;/rnsdhpc/code/spack/opt/spack/clang/zlib/xj36ejk/include;/rnsdhpc/code/spack/opt/spack/clang/libszip/slsy6ko/include
  - HDF5_INCLUDE_DIRS=/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd/include;/rnsdhpc/code/spack/opt/spack/clang/zlib/xj36ejk/include;/rnsdhpc/code/spack/opt/spack/clang/libszip/slsy6ko/include
@@ -42,100 +41,3 @@ using custom HDF5
  - HDF5_ROOT=/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd
  - HDF5_VALID_LANGUAGE_BINDINGS=C;CXX;Fortran
  - HDF5_VERSION=1.10.6
- - L=
- - _HDF5_COMPILE_ARGS=/usr/bin/clang;-I/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd/include;-I/rnsdhpc/code/spack/opt/spack/clang/zlib/xj36ejk/include;-I/rnsdhpc/code/spack/opt/spack/clang/libszip/slsy6ko/include;-fPIC;-c;/Users/s3j/_cmaketest/build/CMakeFiles/hdf5/cmake_hdf5_test.c;/usr/bin/clang;-I/rnsdhpc/code/spack/opt/spack/clang/zlib/xj36ejk/include;-I/rnsdhpc/code/spack/opt/spack/clang/libszip/slsy6ko/include;-fPIC;cmake_hdf5_test.o;-L/rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd/lib;-lhdf5_hl;-lhdf5;-L/rnsdhpc/code/spack/opt/spack/clang/zlib/xj36ejk/lib;-L/rnsdhpc/code/spack/opt/spack/clang/libszip/slsy6ko/lib;-lsz;-lz;-ldl;-lm
- - _HDF5_NEED_TO_SEARCH=False
- - __lang=
- - arg=
- - component=
- - component_location=-1
- - config_output=	    SUMMARY OF THE HDF5 CONFIGURATION
-	    =================================
-
-General Information:
--------------------
-                   HDF5 Version: 1.10.6
-                  Configured on: Thu Mar 19 09:25:11 EDT 2020
-                  Configured by: s3j@vostok
-                    Host system: x86_64-apple-darwin18.7.0
-              Uname information: Darwin vostok 18.7.0 Darwin Kernel Version 18.7.0: Thu Jan 23 06:52:12 PST 2020; root:xnu-4903.278.25~1/RELEASE_X86_64 x86_64
-                       Byte sex: little-endian
-             Installation point: /rnsdhpc/code/spack/opt/spack/clang/hdf5/yefifpd
-
-Compiling Options:
-------------------
-                     Build Mode: production
-              Debugging Symbols: yes
-                        Asserts: no
-                      Profiling: no
-             Optimization Level: high
-
-Linking Options:
-----------------
-                      Libraries: static, shared
-  Statically Linked Executables: 
-                        LDFLAGS: 
-                     H5_LDFLAGS:  -Wl,-commons,use_dylibs
-                     AM_LDFLAGS:  -L/rnsdhpc/code/spack/opt/spack/clang/zlib/xj36ejk/lib -L/rnsdhpc/code/spack/opt/spack/clang/libszip/slsy6ko/lib
-                Extra libraries: -lsz -lz -ldl -lm 
-                       Archiver: ar
-                       AR_FLAGS: cr
-                         Ranlib: ranlib
-
-Languages:
-----------
-                              C: yes
-                     C Compiler: /rnsdhpc/code/spack/lib/spack/env/clang/clang
-                       CPPFLAGS: 
-                    H5_CPPFLAGS:   -DNDEBUG -UH5_DEBUG_API
-                    AM_CPPFLAGS:  -I/rnsdhpc/code/spack/opt/spack/clang/zlib/xj36ejk/include -I/rnsdhpc/code/spack/opt/spack/clang/libszip/slsy6ko/include
-                        C Flags: -fPIC
-                     H5 C Flags:     
-                     AM C Flags: 
-               Shared C Library: yes
-               Static C Library: yes
-
-
-                        Fortran: yes
-               Fortran Compiler: /rnsdhpc/code/spack/lib/spack/env/clang/gfortran ( GNU Fortran (Homebrew GCC 9.2.0_2) 9.2.0)
-                  Fortran Flags: -fPIC
-               H5 Fortran Flags:  -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising -Wno-c-binding-type  -g -O2
-               AM Fortran Flags: 
-         Shared Fortran Library: yes
-         Static Fortran Library: yes
-
-                            C++: no
-
-                           Java: no
-
-
-Features:
----------
-                   Parallel HDF5: no
-Parallel Filtered Dataset Writes: no
-              Large Parallel I/O: no
-              High-level library: yes
-                Build HDF5 Tests: yes
-                Build HDF5 Tools: yes
-                    Threadsafety: no
-             Default API mapping: v110
-  With deprecated public symbols: yes
-          I/O filters (external): deflate(zlib),szip(encoder)
-                             MPE: no
-                      Direct VFD: no
-              (Read-Only) S3 VFD: no
-            (Read-Only) HDFS VFD: no
-                         dmalloc: no
-  Packages w/ extra debug output: none
-                     API tracing: no
-            Using memory checker: no
- Memory allocation sanity checks: no
-          Function stack tracing: no
-       Strict file format checks: no
-    Optimization instrumentation: no
-
- - config_return=0
- - lib_type_args=-shlib
- - scratch_dir=/Users/s3j/_cmaketest/build/CMakeFiles/hdf5
- - test_file=/Users/s3j/_cmaketest/build/CMakeFiles/hdf5/cmake_hdf5_test.c
- - version_match=HDF5 Version: 1.10.6

Fixes: #20718 (closed)
Topic-rename: FindHDF5-cleanup

Edited by Brad King

Merge request reports