Make sure the cache variable is defined before recording it for downstream
With CMake 3.28 I'm getting an error in downstream projects (see https://lhcb-nightlies.web.cern.ch/nightly/lhcb-gaudi-head/3872/GaussinoExtLibs/x86_64_v2-el9-gcc12-opt/build#configure_281):
CMake Error at /workspace/build/Geant4/InstallArea/x86_64_v2-el9-gcc12-opt/lib/Geant4-10.7.3.1/Geant4PackageCache.cmake:22 (geant4_set_and_check_package_variable):
geant4_set_and_check_package_variable Macro invoked with incorrect
arguments for macro named: geant4_set_and_check_package_variable
This is due to the line:
geant4_set_and_check_package_variable(EXPAT_LIBRARY "" "")
which should probably read
geant4_set_and_check_package_variable(EXPAT_LIBRARY "" "" "")
as geant4_set_and_check_package_variable
expects 4 arguments (although it would probably be an error too).
This change make sure that the configuration generates only valid lines in Geant4PackageCache.cmake
.