Problem 2483 - Geant4Config.cmake missing C support with VTK
Summary: Geant4Config.cmake missing C support with VTK
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: cmake (show other problems)
Version: 11.0
Hardware: All All
: P4 normal
Assignee: Ben Morgan
URL:
Depends on:
Blocks:
 
Reported: 2022-04-10 11:14 CEST by Stephan Lachnit
Modified: 2022-12-08 14:37 CET (History)
0 users

See Also:


Attachments
Patch to fix the issue (431 bytes, patch)
2022-04-10 11:14 CEST, Stephan Lachnit
Details | Diff

Note You need to log in before you can comment on or make changes to this problem.
Description Stephan Lachnit 2022-04-10 11:14:07 CEST
Created attachment 765 [details]
Patch to fix the issue

When building with VTK, including Geant4 via CMake fails with the following error:

CMake Error at /usr/lib/x86_64-linux-gnu/cmake/vtk-9.1/VTK-targets.cmake:518 (set_target_properties):
  The link interface of target "VTK::mpi" contains:

    MPI::MPI_C

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/vtk-9.1/vtk-config.cmake:138 (include)
  /usr/share/cmake-3.23/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /usr/lib/x86_64-linux-gnu/Geant4-11.0.1/Geant4Config.cmake:594 (find_dependency)
  src/tools/geant4/CMakeLists.txt:13 (FIND_PACKAGE)


This can be fixed by adding enable_language(C) in Geant4Config.cmake, I attached a patch with this fix.

However I'm not an expert at CMake and I'm not entirely sure if this is a problem with Geant4 or a bug in the VTK CMake config.
Comment 1 Stephan Lachnit 2022-04-10 11:18:01 CEST
I'm using Debian Sid, building Geant4 11.0.1 with VTK 9.1.0 (9.1.0+really9.1.0+dfsg2-3+b2)
Comment 2 Ben Morgan 2022-04-25 14:24:55 CEST
I would suspect this is an issue with the VTK config file - the only thing that might be from the Geant4 side is to limit the VTK components requested (we don't use MPI, so possible this can be fixed by only declaring what we must have in find_dependency(VTK)).

I don't think the correct fix is an enable_language(C) in the config file. That should be determined by the dependency or calling project.
Comment 3 Stephan Lachnit 2022-04-28 11:48:39 CEST
(In reply to Ben Morgan from comment #2)
> I would suspect this is an issue with the VTK config file - the only thing
> that might be from the Geant4 side is to limit the VTK components requested
> (we don't use MPI, so possible this can be fixed by only declaring what we
> must have in find_dependency(VTK)).

Thanks for the reply! Could you add such a declaration?
Comment 4 Ben Morgan 2022-07-13 14:11:02 CEST
Sorry for the delay here - we're reviewing what parts of VTK Geant4 requires and whether that impacts what is refound in Geant4Config.cmake. We'll have a solution in time for the 11.1 release, and should be backport-able to earlier versions.
Comment 5 Stephan Lachnit 2022-12-08 14:37:01 CET
It seems like this has been resolved in Vtk, the problem does not appear anymore.