Problem 2139

Summary: Qt OpenGL visualizer not available when searching for it with OPTIONAL_COMPONENTS CMake flag
Product: Geant4 Reporter: Nicola Mori <mori>
Component: cmakeAssignee: Ben Morgan <Ben.Morgan>
Status: CLOSED FIXED    
Severity: normal CC: mori
Priority: P4    
Version: 10.5   
Hardware: PC   
OS: Linux   

Description Nicola Mori 2019-02-19 15:42:37 CET
In my program I search for Geant4 with the following CMake instruction:

  find_package(Geant4 10.04 QUIET OPTIONAL_COMPONENTS qt)

It correctly finds the qt components, and indeed the value of the Geant4_qt_FOUND variable is ON. However, my application is unable to display the detector geometry with Qt OpenGL and it prints this error message:

  parameter value (OGL) is not listed in the candidate List.
  Candidates are: ATree DAWNFILE HepRepFile HepRepXML RayTracer VRML1FILE VRML2FILE gMocrenFile

If I change the find_package invocation to:

  find_package(Geant4 10.04 QUIET COMPONENTS qt)

then it works as expected. I investigated a bit and I found that in Geant4Config.cmake at line 435 the setting of the compiler flags for using Qt OpenGL is guarded by a check on the Geant4_FIND_REQUIRED_qt variable. This variable is set to 1 only if find_package is called with COMPONENTS but not when called with OPTIONAL_COMPONENTS, even when Qt is found.
Comment 1 Ben Morgan 2019-03-06 16:05:19 CET
Thanks for the report, we'll take a look.
Comment 2 Ben Morgan 2019-07-09 12:18:51 CEST
Now fixed on master, and required a more general fix so thanks for the report! The fix will be in this winter's 10.6 release, plus any patches to earlier versions.