GEANT4_ADD_TEST(gps-build
				SOURCE_DIR ${CMAKE_SOURCE_DIR}/examples/extended/eventgenerator/exgps
				BINARY_DIR ${CMAKE_BINARY_DIR}/examples/extended/eventgenerator/exgps
				BUILD exgps
				LABELS PhysicsChecks)

SET(_wd ${CMAKE_BINARY_DIR}/examples/extended/eventgenerator/exgps/stattest)
FILE(MAKE_DIRECTORY ${_wd})


GEANT4_ADD_TEST(gps-run
				WORKING_DIRECTORY ${_wd}
				DEPENDS gps-build
				ENVIRONMENT ${GEANT4_TEST_ENVIRONMENT}
				LABELS PhysicsChecks
				COMMAND ${CMAKE_BINARY_DIR}/examples/extended/eventgenerator/exgps/exgps
  						  ${CMAKE_SOURCE_DIR}/examples/extended/eventgenerator/exgps/exgps_MT.in
			        )

FIND_PACKAGE(StatTest QUIET)
IF(STATTEST_FOUND)

	
	STATTEST_ADD_TEST(gps-checkOutput
					  G4TEST gps-run
					  CONFIG "${CMAKE_SOURCE_DIR}/examples/extended/eventgenerator/exgps/stattest/conf.qa"
					  REFERENCE "${GEANT4_TEST_REFERENCES_URL}/examples/extended/eventgenerator/exgps/reference-V10-00-ref-08.root"
					  INPUT "${_wd}/exgps_t*.root"
					  IMG "gps.pdf"
					  LABELS PhysicsChecks
					 )
				
ENDIF()
