************************************************************************
* Build and Test HDF4 Examples with CMake                              *
************************************************************************

Notes: This short instruction is written for users who want to quickly
       test the installation of HDF4 by using the CMake tools to build
       and test the HDF4 Examples. The following instructions will show
       the default usage and then present common changes for non-default
       installations.
       For more information, see the USING_HDF4_CMake.txt file.

       More information about using CMake can be found at the KitWare
       site, www.cmake.org.

       CMake uses the command line and these instructions use the script
       method of the ctest command.


========================================================================
I. Preconditions
========================================================================

   1. We suggest you obtain the latest CMake for your platform from the Kitware
      web site. The HDF 4.3.x product requires a minimum CMake version
      of 3.18. If you are using VS2022, the minimum CMake version is 3.21.

   2. You have installed the HDF4 library built with CMake, by executing
      the HDF Install Utility (the *.msi file in the binary package for
      Windows or the *.sh on Linux). You can obtain pre-built binaries
      from The HDF Group's website at www.hdfgroup.org.



========================================================================
II. Building HDF4 Examples with CMake
========================================================================

Files in the HDF4 install directory:
       HDF4Examples folder
       CTestScript.cmake
       HDF4_Examples.cmake
       HDF4_Examples_options.cmake

Default installation process:
       Create a directory to run the examples, i.e. \test_hdf4.
       Copy HDF4Examples folder to this directory.
       Copy CTestScript.cmake to this directory.
       Copy HDF4_Examples.cmake to this directory.
       Copy HDF4_Examples_options.cmake to this directory.
       Change directory into this directory.
       The default source folder is defined as "HDF4Examples". It can be changed
           with the CTEST_SOURCE_NAME script option.
       The default installation folder is defined for the platform.
           It can be changed with the INSTALLDIR script option.
           (Note: Windows has issues with spaces and paths -The path will need to
            be set correctly.)
       The default ctest configuration is defined as "Release". It can be changed
           with the CTEST_CONFIGURATION_TYPE script option. Note that this must
           be the same as the value used with the -C command line option.
       The default build configuration is defined to build and use static libraries.
           Shared libraries can be used with the STATIC_ONLY script option set to "NO".

       Other options can be changed by editing the 
           HDF4_Examples_options.cmake file.

       If the defaults are okay, execute from this directory:
           ctest -S HDF4_Examples.cmake -C Release -V -O test.log
       If the defaults need change, execute from this directory:
           ctest -S HDF4_Examples.cmake,CTEST_SOURCE_NAME=MyExamples,INSTALLDIR=MyLocation -C Release -V -O test.log

    When executed, the ctest script will save the results to the log file, test.log, as
    indicated by the ctest command. If you wish to see more build and test information,
    add "-VV" to the ctest command. The output should show;
          100% tests passed, 0 tests failed out of 49.


========================================================================
III. Other changes to the HDF4_Examples.cmake file
========================================================================

Line 56-58: uncomment to use a source tarball or zipfile;
     Add script option "TAR_SOURCE=MySource.tar".


========================================================================
IV. cacheinit.cmake defaults
========================================================================

The config/cacheinit.cmake file in the examples source changes the defaults
of the CMake options. If the CTest script mode, as described above, is not used
note that the following options will not be changed.
    BUILD_SHARED_LIBS     OFF     CACHE BOOL   "Build Shared Libraries"
    HDF_BUILD_C           ON      CACHE BOOL   "Build C support"
    HDF_BUILD_FORTRAN     OFF     CACHE BOOL   "Build FORTRAN support"
    HDF_BUILD_JAVA        ON      CACHE BOOL   "Build Java support"
    BUILD_TESTING         ON      CACHE BOOL   "Build HDF4 Unit Testing"
    COMPARE_TESTING       ON      CACHE BOOL   "Compare HDF4 Unit Testing to Reference"
    HDF4_PACKAGE_NAME     "hdf4"  CACHE STRING "Name of HDF4 package"
    PACK_EXAMPLE_SOURCE   ON      CACHE BOOL   "Package the source"
    CPACK_PACKAGE_VERSION "0.3.9" CACHE STRING "Version of HDF4 source package"

