************************************************************************
* Build and Install H4H5 C Library and tools with CMake                *
************************************************************************

                     Table of Contents

Section I:    Preconditions
Section II:   Quick Step Building H4H5 Library with CMake Script Mode
Section III:  Quick Step Building H4H5 Library with CMake Command Mode
Section IV:   Further considerations
Section V:    Options for building H4H5 Library with CMake command line
Section VI:   CMake option defaults for H4H5
Section VII:  User Defined Options for H4H5 Library with CMake

************************************************************************


========================================================================
I. Preconditions
========================================================================
Obtaining H4H5 source code
   1. Create a directory for your development; for example, "myhdfstuff".

   2. Obtain compressed (*.tar or *.zip) H4H5 source from
         https://portal.hdfgroup.org/display/support/Building+H4H5+with+CMake
      and put it in "myhdfstuff".
      Uncompress the file. There should be a h4h5-2.2."X" folder.

CMake version
   1. We suggest you obtain the latest CMake from the Kitware web site.
      The H4H5 2.2."X" product requires a minimum CMake version 3.2.2,
      where "X" is the current H4H5 release version.

Note:
   To change the install prefix from the platform defaults initialize
   the CMake variable, CMAKE_INSTALL_PREFIX. Users of build scripts
   will use the INSTALLDIR option.


========================================================================
II. Quick Step Building H4H5 Libraries with CMake Script Mode
========================================================================
This short set of instructions is written for users who want to quickly
build the H4H5 C shared library and tools from the H4H5 source code package
using the CMake tools. This procedure will use the default settings in the
config/cmake/cacheinit.cmake file and installed HDF4 and HDF5 packages.
HDF Group recommends using the ctest script mode to build H4H5.

The following files referenced below are available at the HDF web site:
     https://portal.hdfgroup.org/display/support/Building+H4H5+with+CMake

Single compressed file with all the files needed, including source:
    For hdf5-1.12 based tools: CMake-h4h5-1.12.X.zip or CMake-h4h5-1.12.X.tar.gz
    For hdf5-1.10 based tools: CMake-h4h5-1.10.X.zip or CMake-h4h5-1.10.X.tar.gz
    For hdf5-1.8 based tools: CMake-h4h5-1.8.X.zip or CMake-h4h5-1.8.X.tar.gz

Individual files included in the above mentioned compressed files
-----------------------------------------------
CMake build script:
    CTestScript.cmake

HDF4 and HDF5 binaries:
    hdf5-1.12.0 or hdf5-1.10.6 or hdf5-1.8.22 binaries 
    and hdf-4.2.15 binaries have been tested.

External compression, hdf4 and hdf5 libraries:
    SZip.tar.gz
    ZLib.tar.gz
    JPEG8d.tar.gz
    HDF4.tar.gz
    HDF5.tar.gz

Platform configuration files:
    H4H5config.cmake
    H4H5options.cmake

Build scripts for windows or linux
-----------------------------------------------

To build H4H5 with all the external libraries you will need to:

   1. Change to the development directory "myhdfstuff".

   2. Download the hdf5 and hdf4 binaries and install them.

   3. Download the CMake-h4h5-1.Y.X.zip(.tar.gz) file to "myhdfstuff".
      Uncompress the file.

   4. Change to the source directory "h4h5-1.y.x".
      CTestScript.cmake file should not be modified.

   5. Edit the platform configuration file, H4H5options.cmake, if you want to change
      the default build environment.
      (See  https://portal.hdfgroup.org/display/support/How+to+Change+H4H5+CMake+Build+Options)

   6. From the "myhdfstuff" directory execute the CTest Script with the
      following options:

      On 32-bit Windows with Visual Studio 2019, execute:
         ctest -S H4H5config.cmake,BUILD_GENERATOR=VS2019 -C Release -VV -O hdf.log
      On 64-bit Windows with Visual Studio 2019, execute:
         ctest -S H4H5config.cmake,BUILD_GENERATOR=VS201964 -C Release -VV -O hdf.log
      On 32-bit Windows with Visual Studio 2017, execute:
         ctest -S H4H5config.cmake,BUILD_GENERATOR=VS2017 -C Release -VV -O hdf.log
      On 64-bit Windows with Visual Studio 2017, execute:
         ctest -S H4H5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf.log
      On 32-bit Windows with Visual Studio 2015, execute:
         ctest -S H4H5config.cmake,BUILD_GENERATOR=VS2015 -C Release -VV -O hdf.log
      On 64-bit Windows with Visual Studio 2015, execute:
         ctest -S H4H5config.cmake,BUILD_GENERATOR=VS201564 -C Release -VV -O hdf.log
      On Linux and Mac, execute:
         ctest -S H4H5config.cmake,BUILD_GENERATOR=Unix -C Release -VV -O hdf.log
      The supplied build scripts are versions of the above.

      The command above will configure, build, test, and create an install
      package in the myhdfstuff folder. It will have the format:
          H4H5-2.2.NN-<platform>.<zip or tar.gz>

          On Unix, <platform> will be "Linux". A similar .sh file will also be created.
          On Windows, <platform> will be "win64" or "win32". If you have an
          installer on your system, you will also see a similar file that ends
          in either .exe (NSIS) or .msi (WiX).

      Notes on the command line options.
          The -S option uses the script version of ctest.

          The value for the -C option (as shown above, "-C Release") must
          match the setting for CTEST_CONFIGURATION_TYPE in the platform
          configuration file.

          The -VV option is for most verbose; use -V for less verbose.

          The "-O hdf.log" option saves the output to a log file hdf.log.

   7. To install, "X" is the current release version

      On Windows (with WiX installed), execute:
                H4H5-2.2."X"-win32.msi or H4H5-2.2."X"-win64.msi
      By default this program will install the h4h5 library and tools
      into the "C:\Program Files" directory and will create the following
      directory structure:
         HDF_Group
         --H4H5
         ----2.2."X"
         ------bin
         ------include
         ------lib
         ------cmake

      On Linux, change to the install destination directory
      (create it if doesn't exist) and execute:
                <path-to>/myhdfstuff/H4H5-2.2."X"-Linux.sh
      After accepting the license, the script will prompt:
        By default the H4H5 will be installed in:
        "<current directory>/H4H5-2.2."X"-Linux"
        Do you want to include the subdirectory H4H5-2.2."X"-Linux?
        Saying no will install in: "<current directory>" [Yn]:
      Note that the script will create the following directory structure
      relative to the install point:
         HDF_Group
         --H4H5
         ----2.2."X"
         ------bin
         ------include
         ------lib
         ------share
      By default the installation will create the folders in the
      <install destination directory>/HDF_Group/H4H5/2.2."X" location.

      On Mac you will find H4H5-2.2."X"-Darwin.dmg in the myhdfstuff folder. Click
      on the dmg file to proceed with installation. After accepting the license,
      there will be a folder with the following structure:
         HDF_Group
         --H4H5
         ----2.2."X"
         ------bin
         ------include
         ------lib
         ------share

      By default the installation will create the bin, include, lib and cmake
      folders in the <install destination directory>/HDF_Group/H4H5/2.2."X"
      The <install destination directory> depends on the build platform;
        Windows will set the default to:
          C:/Program Files/HDF_Group/H4H5/2.2."X"
        Linux will set the default to:
          "myhdfstuff/HDF_Group/H4H5/2.2."X"
      The default can be changed by adding ",INSTALLDIR=<my new dir>" to the
          "ctest -S H4H5config.cmake..." command. For example on linux:
         ctest -S H4H5config.cmake,INSTALLDIR=/usr/local/myh4h5,BUILD_GENERATOR=Unix -C Release -VV -O hdf.log


========================================================================
III. Quick Step Building H4H5 C Static Libraries and Tools with CMake
========================================================================
Notes: This short set of instructions is written for users who want to
       quickly build the just the H4H5 C static library and tools from
       the H4H5 source code package using the CMake command line tools.
       Avoid the use of drive letters in paths on Windows.

   Go through these steps:

      1. Change to the development directory "myhdfstuff".

      2. Uncompress the H4H5 source file

      3. Create a folder "build" in the "myhdfstuff" directory.

      4. Change into the "build" folder.

      5. Configure the C library, tools and tests with one of the following commands:

         On Windows 32 bit
           cmake -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF_BUILD_TOOLS:BOOL=ON ..\h4h5-2.2."X"

         On Windows 64 bit
           cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF_BUILD_TOOLS:BOOL=ON ..\h4h5-2.2."X"

         On Linux and Mac
           cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF_BUILD_TOOLS:BOOL=ON ../h4h5-2.2."X"

         where "X" is the current release version.

      6. Build the C library, tools and tests with this command:
           cmake --build . --config Release

      7. Test the C library and tools with this command:
           ctest . -C Release

      8. Create an install image with this command:
           cpack -C Release CPackConfig.cmake

      9. To install
         On Windows, execute:
                H4H5-2.2."X"-win32.exe or H4H5-2.2."X"-win64.exe
         By default this program will install the h4h5 library into the
         "C:\Program Files" directory and will create the following
         directory structure:
            HDF_Group
            --H4H5
            ----2.2."X"
            ------bin
            ------include
            ------lib
            ------cmake

         On Linux, change to the install destination directory
         (create it if doesn't exist) and execute:
                <path-to>/myhdfstuff/build/H4H5-2.2."X"-Linux.sh
         After accepting the license, the script will prompt:
           By default the H4H5 will be installed in:
           "<current directory>/H4H5-2.2."X"-Linux"
           Do you want to include the subdirectory H4H5-2.2."X"-Linux?
           Saying no will install in: "<current directory>" [Yn]:
         Note that the script will create the following directory structure
         relative to the install point:
            HDF_Group
            --H4H5
            ----2.2."X"
            ------bin
            ------include
            ------lib
            ------share
         By default the installation will create the folders in the
         <install destination directory>/HDF_Group/H4H5/2.2."X" location.

         On Mac you will find H4H5-2.2."X"-Darwin.dmg in the build folder. Click
         on the dmg file to proceed with installation. After accepting the license,
         there will be a folder with the following structure:
            HDF_Group
            --H4H5
            ----2.2."X"
            ------bin
            ------include
            ------lib
            ------share


========================================================================
IV. Further considerations
========================================================================

   1. We suggest you obtain the latest CMake for windows from the Kitware
      web site. The H4H5 2.2."X" product requires a minimum CMake version 2.8.12.

   2. H4H5 requires Zlib, Szip, Jpeg, hdf4, hdf5:
      A. Download the binary packages and install them in a central location.
         For example on Windows, create a folder extlibs and install the
         packages there. Add the following CMake options:
            -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib
            -DZLIB_INCLUDE_DIR:PATH=some_location/include
            -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib
            -DSZIP_INCLUDE_DIR:PATH=some_location/include
            -DJPEG_LIBRARY:FILEPATH=some_location/lib/jpeg.lib
            -DJPEG_INCLUDE_DIR:PATH=some_location/include
            -DHDF4_LIBRARY:FILEPATH=some_location/lib/hdf.lib;some_location/lib/mfhdf.lib
            -DHDF4_INCLUDE_DIR:PATH=some_location/include
            -DHDF5_LIBRARY:FILEPATH=some_location/lib/hdf5.lib
            -DHDF5_INCLUDE_DIR:PATH=some_location/include
         where "some_location" is the full path to the extlibs folder.

      B. Use source packages from a GIT server by adding the following CMake
         options:

            HDF_ALLOW_EXTERNAL_SUPPORT:STRING="GIT"
            HDF4_GIT_URL:STRING="http://some_location/hdf4"
            HDF5_GIT_URL:STRING="http://some_location/hdf5"
            JPEG_GIT_URL:STRING="http://some_location/jpeg"
            ZLIB_GIT_URL:STRING="http://some_location/zlib"
            SZIP_GIT_URL:STRING="http://some_location/szip"
         where "some_location" is the URL to the GIT repository. Also set
         CMAKE_BUILD_TYPE to the configuration type.

      C. Use source packages from a compressed file by adding the following
         CMake options:
            HDF_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ"
            HDF4_TGZ_NAME:STRING="hdf4_src.ext"
            HDF5_TGZ_NAME:STRING="hdf5_src.ext"
            JPEG_TGZ_NAME:STRING="jpeg_src.ext"
            ZLIB_TGZ_NAME:STRING="zlib_src.ext"
            SZIP_TGZ_NAME:STRING="szip_src.ext"
            TGZPATH:STRING="some_location"
         where "some_location" is the URL or full path to the compressed
         file and ext is the type of compression file. Also set CMAKE_BUILD_TYPE
         to the configuration type during configuration

   3. If you are building on Apple Darwin platforms, you should add the
      following options:
          Compiler choice - use xcode by setting the ENV variables of CC and CXX
          Additional options:
            CMAKE_ANSI_CFLAGS:STRING=-fPIC
            CTEST_USE_LAUNCHERS:BOOL=ON
            CMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

   4. Windows developers should install NSIS or WiX to create an install image with CPack.
      Visual Studio Express users will not be able to package H4H5 into
      an install image executable.

   5. Developers can copy the config/cmake/cacheinit.cmake file and alter the
      the settings for the developers' environment. Then the only options needed
      on the command line are those options that are different. Example using HDF
      default cache file:
           cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 14 2015" \
               -DH4H5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DH4H5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF \
               -DCMAKE_BUILD_TYPE:STRING=Release ..

Notes: CMake and H4H5

   1. Using CMake for building and using H4H5 is under active development.
      While we have attempted to provide error-free files, please
      understand that development with CMake has not been extensively
      tested outside of HDF. The CMake specific files may change
      before the next release.

   2. CMake support for H4H5 development should be usable on any
      system where CMake is supported. Please send us any comments on
      how CMake support can be improved on any system. Visit the
      KitWare site for more information about CMake.

   3. Build and test results can be submitted to our CDash server:
      The CDash server for community submissions of hdf5 is at
          https://cdash.hdfgroup.org.

      Submitters are requested to register their name and contact info and
      maintain their test sites. After your first submission, login and go
      to your "My CDash" link and claim your site.

      We ask that all submissions include the configuration information and
      contact information in the CTest Notes Files upload step. See the
      current reports on CDash for examples.

      Please follow the convention that "NIGHTLY" submissions maintain the same
      configuration every time. "EXPERIMENTAL" submissions can be expected to
      be different for each submission.

   4. See the appendix at the bottom of this file for examples of using
      a ctest script for building and testing. Using a ctest script is
      preferred because of its flexibility.

Notes: CMake in General

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

   2. CMake uses the command line; however, the visual CMake tool is
      available for the configuration step. The steps are similar for
      all the operating systems supported by CMake.


========================================================================
V. Options for Building H4H5 Libraries with the CMake Command Line
========================================================================

To build the H4H5 C Library with CMake, go through these five steps:

   1. Run CMake
   2. Configure the cache settings
   3. Build H4H5
   4. Test H4H5
   5. Package H4H5 (create install image)

These five steps are described in detail below.

========================================================================

   1. Run CMake

      The visual CMake executable is named "cmake-gui.exe" on Windows and should be
      available in your Start menu. For Linux, UNIX, and Mac users the
      executable is named "cmake-gui" and can be found where CMake was
      installed.

      Specify the source and build directories.

      ***** Make the build and source directories different. ******

      For example on Windows, if the source is at c:\MyHDFstuff\h4h5,
      then use c:\MyHDFstuff\h4h5\build or c:\MyHDFstuff\build\h4h5 as the
      build directory.

      RECOMMENDED:
        Users can perform the configuration step without using the visual
        cmake-gui program. We use the file cacheinit.cmake in the
        config/cmake source folder for our testing. This file enables all of the
        basic options and we turn specific options on or off for testing
        using the following command line within the build directory:

        cmake -C <sourcepath>/config/cmake/cacheinit.cmake -G "<generator>"  [-D<options>]  <sourcepath>

        Where <generator> is
            * MinGW Makefiles
            * NMake Makefiles
            * Unix Makefiles
            * Visual Studio 11 2012
            * Visual Studio 11 2012 Win64
            * Visual Studio 12 2013
            * Visual Studio 12 2013 Win64
            * Visual Studio 14 2015
            * Visual Studio 14 2015 Win64

        <options> is:
            * HDF4_INCLUDE_DIR:PATH=<path to hdf4 includes directory>
            * HDF4_LIBRARY:FILEPATH=<path to hdf4/library file>
            * HDF5_INCLUDE_DIR:PATH=<path to hdf5 includes directory>
            * HDF5_LIBRARY:FILEPATH=<path to hdf5/library file>
            * SZIP_INCLUDE_DIR:PATH=<path to szip includes directory>
            * SZIP_LIBRARY:FILEPATH=<path to szip/library file>
            * ZLIB_INCLUDE_DIR:PATH=<path to zlib includes directory>
            * ZLIB_LIBRARY:FILEPATH=<path to zlib/library file>
            * JPEG_INCLUDE_DIR:PATH=<path to jpeg includes directory>
            * JPEG_LIBRARY:FILEPATH=<path to jpeg/library file>
            * <H4H54OPTION>:BOOL=[ON | OFF]

        <cacheinit.cmake> is:
                # This is the CMakeCache file used by HDF Group for daily tests.
                ########################
                # EXTERNAL cache entries
                ########################
                set (BUILD_SHARED_LIBS OFF CACHE BOOL "Build Shared Libraries" FORCE)
                set (USE_SHARED_LIBS OFF CACHE BOOL "Use Shared Libraries" FORCE)
                set (BUILD_TESTING ON CACHE BOOL "Build H4H5 Unit Testing" FORCE)
                set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE)
                set (HDF_BUILD_EXAMPLES ON CACHE BOOL "Build H4H5 Library Examples" FORCE)
                set (HDF_BUILD_TOOLS ON CACHE BOOL "Build H4H5 Tools" FORCE)
                set (HDF_BUILD_UTILS ON CACHE BOOL "Build H4H5 Library Utilities" FORCE)
                set (H4H5_ENABLE_EOS2 ON CACHE BOOL "Allow conversions of HDF4-EOS2 files" FORCE)
                set (H4H5_TEST_HDFEOS2 OFF CACHE BOOL "Test H4H5 EOS Library Utility" FORCE)
                set (HDF_ENABLE_JPEG_LIB_SUPPORT ON CACHE BOOL "Enable Jpeg library" FORCE)
                set (HDF_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE)
                set (HDF_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE)
                set (HDF_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE)
                set (HDF5_USE_16_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.6.x API" FORCE)
                set (HDF_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE)
                set (HDF_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE)
                set (HDF_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE)
                set (HDF_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE)
                set_property (CACHE HDF_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ)
                set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
                set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
                set (JPEG_TGZ_NAME "JPEG8b.tar.gz" CACHE STRING "Use JPEG from compressed file" FORCE)
                set (HDF4_TGZ_NAME "HDF4.tar.gz" CACHE STRING "Use HDF4 from compressed file" FORCE)
                set (HDF5_TGZ_NAME "HDF5.tar.gz" CACHE STRING "Use HDF5 from compressed file" FORCE)
                set (HDF4_PACKAGE_NAME "hdf4" CACHE STRING "Name of HDF4 package" FORCE)
                set (HDF5_PACKAGE_NAME "hdf5" CACHE STRING "Name of HDF5 package" FORCE)
                set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE)
                set (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE)
                set (JPEG_PACKAGE_NAME "jpeg" CACHE STRING "Name of JPEG package" FORCE)

   2. Configure the cache settings

      2.1  Visual CMake users, click the Configure button. If this is the first time you are
           running cmake-gui in this directory, you will be prompted for the
           generator you wish to use (for example on Windows, Visual Studio 12).
           CMake will read in the CMakeLists.txt files from the source directory and
           display options for the H4H5 project. After the first configure you
           can adjust the cache settings and/or specify the locations of other programs.

           Any conflicts or new values will be highlighted by the configure
           process in red. Once you are happy with all the settings and there are no
           more values in red, click the Generate button to produce the appropriate
           build files.

           On Windows, if you are using a Visual Studio generator, the solution and
           project files will be created in the build folder.

           On linux, if you are using the Unix Makefiles generator, the Makefiles will
           be created in the build folder.

      2.2  Preferred command line example on Windows in c:\MyHDFstuff\hdf5\build directory:

               cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 14 2015" \
               -DH4H5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DH4H5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF \
               -DCMAKE_BUILD_TYPE:STRING=Release ..

      2.3  On Windows, if you are using a Visual Studio Express version you must
           be sure that the following two options are correctly set/unset:

           H4H5_NO_PACKAGES:BOOL=ON
           H4H5_USE_FOLDERS:BOOL=OFF

   3. Build H4H5

      On Windows, you can build H4H5 using either the Visual Studio Environment
      or the command line. The command line can be used on all platforms;
      Windows, linux, Unix, and Mac.

      To build from the command line, navigate to your build directory and
      execute the following:

              cmake --build . --config {Debug | Release}

      NOTE: "--config {Debug | Release}" may be optional on your platform. We
            recommend choosing either Debug or Release on Windows.

      3.1  If you wish to use the Visual Studio environment, open the solution
           file in your build directory. Be sure to select either Debug or
           Release and build the solution.

      3.2.1  The external libraries (zlib, Szip, jpeg, hdf4 and hdf5) can be
           configured to allow building the libraries by downloading from
           a GIT repository. The option is 'HDF_ALLOW_EXTERNAL_SUPPORT';
           by adding the following configuration option:
               -DHDF_ALLOW_EXTERNAL_SUPPORT:STRING="GIT"

           The options to control the GIT URL (config/cmake/cacheinit.cmake file) are:
               HDF4_GIT_URL:STRING="https://${git_url}/hdf4"
               HDF5_GIT_URL:STRING="https://${git_url}/hdf5"
               JPEG_GIT_URL:STRING="https://${git_url}/jpeg"
               ZLIB_GIT_URL:STRING="https://${git_url}/zlib"
               SZIP_GIT_URL:STRING="https://${git_url}/szip"
           ${git_url} should be changed to your location. Also define CMAKE_BUILD_TYPE
           to be the configuration type.

      3.2.2  Or the external libraries (zlib, szip, jpeg, hdf4 and hdf5) can
           be configured to allow building the libraries by using a compressed
           file. The option is 'HDF_ALLOW_EXTERNAL_SUPPORT' and is enabled by
           adding the following configuration option:
               -DHDF_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ"

           The options to control the TGZ URL (config/cmake/cacheinit.cmake
           file) are:
               HDF4_TGZ_NAME:STRING="hdf4_src.ext"
               HDF5_TGZ_NAME:STRING="hdf5_src.ext"
               JPEG_TGZ_NAME:STRING="jpeg_src.ext"
               ZLIB_TGZ_NAME:STRING="zlib_src.ext"
               SZIP_TGZ_NAME:STRING="szip_src.ext"
               TGZPATH:STRING="some_location"
           where "some_location/xxxx_src.ext" is the URL or full path to
           the compressed file and where ext is the type of the compression
           file such as .bz2, .tar, .tar.gz, .tgz, or .zip. Also define
           CMAKE_BUILD_TYPE to be the configuration type.

   4. Test H4H5

      To test the build, navigate to your build directory and execute:

              ctest . -C {Debug | Release}

      NOTE: "-C {Debug | Release}" may be optional on your platform. We
            recommend choosing either Debug or Release to match the build
            step on Windows.

   5. Packaging H4H5 (create an install image)

      To package the build into a simple installer using WiX toolset or the NullSoft installer NSIS
      on Windows, or into compressed files (.tar.gz, .sh, .zip), use the CPack tool.

      To package the build, navigate to your build directory and execute;

              cpack -C {Debug | Release} CPackConfig.cmake

      NOTE: See note 8 of this document for NSIS information.
            See note 9 of this document for WiX information.
            Also, if you are using a Visual Studio Express version or
            want to disable the packaging components, set H4H5_NO_PACKAGES
            to ON (on the command line add -DH4H5_NO_PACKAGES:BOOL=ON)

   6. The files that support building H4H5 with CMake are all the files in the
      config/cmake folder, the CMakeLists.txt files in each source folder, and
      CTestConfig.cmake. CTestConfig.cmake is specific to the internal testing
      performed by The HDF Group. It should be altered for the user's
      installation and needs. The cacheinit.cmake file settings are used by
      The HDF Group for daily testing. It should be altered/ignored for the user's
      installation and needs.

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

   8. Nullsoft Scriptable Install System
      The Nullsoft Scriptable Install System (NSIS) is an open source installation
      system. It was created by the WinAmp authors to distribute that application,
      but it is now a general-purpose system which anyone might use. NSIS installers
      recognize /S for silent installation and /D=dir to specify the
      "output directory", which is where the program will be installed. These
      options are case-sensitive, so be sure to type them in upper case.

   9. WiX Toolset
      WiX--the Windows Installer XML toolset--lets developers create installers for
      Windows Installer, the Windows installation engine. See http://wixtoolset.org.


========================================================================
VI. CMake Option Defaults for H4H5
========================================================================

In the options listed below, there are three columns of information:
Option Name, Option Description, and Option Default.
The config/cmake/cacheinit.cmake file can override the following values.

---------------- General Build Options ---------------------
BUILD_SHARED_LIBS  "Build Shared Libraries"    OFF
BUILD_TESTING      "Build H4H5 Unit Testing"   OFF

---------------- H4H5 Build Options ---------------------
HDF_BUILD_EXAMPLES      "Build H4H5 Library Examples"                 OFF
HDF_BUILD_TOOLS         "Build H4H5 Tools"                            OFF
HDF_BUILD_UTILS         "Build H4H5 Utilities"                        OFF
HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default"           ON
HDF_LEGACY_NAMING       "Use Legacy Names for Libraries and Programs" ON
---------------- HDF-JAVA Apple Build Options ---------------------
HDF_BUILD_WITH_INSTALL_NAME        "Build with library install_name set to the installation path" OFF
HDF_PACK_MACOSX_BUNDLE             "Create a Mac OSX Application Bundle"                          OFF

---------------- HDF-JAVA Native Options ---------------------
HDF_DISABLE_COMPILER_WARNINGS      "Disable compiler warnings"                                    OFF

---------------- H4H5 Advanced Options ---------------------
HDF_DISABLE_COMPILER_WARNINGS "Disable compiler warnings"                                   OFF
HDF_ENABLE_COVERAGE           "Enable code coverage for Libraries and Programs"             OFF
H4H5_ENABLE_EOS2              "Allow conversions of HDF4-EOS2 files"                        ON
HDF_ENABLE_LARGE_FILE         "Enable support for large (64-bit) files on Linux."           ON
HDF_PACKAGE_EXTLIBS           "CPACK - include external libraries"                          OFF
H4H5_NO_PACKAGES              "Do not include CPack Packaging"                              OFF
H4H5_USE_FOLDERS              "Enable folder grouping of projects in IDEs."                 OFF

---------------- External Library Options ---------------------
HDF_ALLOW_EXTERNAL_SUPPORT      "Allow External Library Building"                         "NO"
HDF_ENABLE_JPEG_LIB_SUPPORT     "Enable libjpeg"                                           ON
HDF_ENABLE_SZIP_SUPPORT         "Use SZip Filter"                                          OFF
HDF_ENABLE_Z_LIB_SUPPORT        "Enable Zlib Filters"                                      ON
HDF4_USE_EXTERNAL               "Use External Library Building for HDF4"                   0
HDF5_USE_EXTERNAL               "Use External Library Building for HDF5"                   0
JPEG_USE_EXTERNAL               "Use External Library Building for JPEG"                   0
SZIP_USE_EXTERNAL               "Use External Library Building for SZIP"                   0
ZLIB_USE_EXTERNAL               "Use External Library Building for ZLIB"                   0
if (HDF_ENABLE_SZIP_SUPPORT)
    HDF_ENABLE_SZIP_ENCODING "Use SZip Encoding"                                           OFF



========================================================================
VII. User Defined Options for H4H5 Libraries with CMake
========================================================================

Support for User Defined macros and options has been added. The file
UserMacros.cmake has an example of the technique. In the folder,
config/cmake/UserMacros, is an implementation for Windows Visual Studio
users for linking libraries to the static CRT - Windows_MT.cmake.

Copy the contents of the file, both macro and option, into the
UserMacros.cmake file. Then enable the option to the CMake configuration,
build and test process.


========================================================================
For further assistance, send email to help@hdfgroup.org
========================================================================



