When building recent Geant4 releases, we include the CMake options -DGEANT4_USE_INVENTOR=ON -DINVENTOR_INCLUDE_DIR=<Coin-path>/include -DINVENTOR_LIBRARY=<Coin-path>/lib/libCoin.so -DINVENTOR_SOXT_LIBRARY=<Coin-path>/lib/libSoXt.so -DINVENTOR_SOXT_INCLUDE_DIR=<Coin-path>/include/Inventor/Xt Where <Coin-path> is the path to our local Coin3D installation. With G4 10.04 and 10.05 this works as expected. With G4 10.06, the build of visualization/OpenInventor fails on the first file, because the OI include files (e.g., Inventor/fields/SoSFFloat.h) are not found. Inspecting the CMake-generated file source/visualization/OpenInventor/CMakeFiles/G4OpenInventor.dir/flags.make, I see that none of the Coin directories are included in the CXX_INCLUDES setting. (As an aside, I also see that essentially the entire collection of G4 directories is included, which wasn't the case in 10.05). I have not yet managed to dig through the convoluted CMake configuration system to identify why INVENTOR_INCLUDE_DIR and INVENTOR_SOXT_INCLUDE_DIR are not properly used, but it's clear that something is broken.
Just to follow up, I compared the visualization/OpenInventor/sources.cmake files for 10.05 and 10.06, and they are functionally identical. Only the line "include(${QT_USE_FILE})" was removed in going to 10.06. In particular, all of the "include_directories()" actions are identical, and in the same order, in both releases; specifically, "include_directories(${INVENTOR_INCLUDE_DIR})" appears in both.
I could reproduce the problem on a build made from scratch. It simply seems that the headers of the OpenInventor driver are not being installed at all. Ben, can you take a look?
Sorry... correction to my previous post... Open Inventor driver headers are not found while building (not at installation...).
More info on this (which also explains why I had my Inventor installation working in the past)... - My installation of Coin/Inventor is on /usr/local. INVENTOR_INCLUDE_DIR is properly set to /usr/local/include; - At compilation, "-isystem /usr/local/include" does not show up, leading to the compilation errors; - If, at configuration, I also turn on XM (GEANT4_USE_XM, and in my case Xm is also installed in /usr/local), the path is being properly added and everything works.
O.k., I'll take a look, but won't be immediately as I'm pretty busy right now.
Thank you for fixing this so quickly, Ben. I noticed that you changed "include_directories()" to "target_include_directories()" for OI. Is it possible that the underlying change (no longer using include_directories() for each directory's dependencies) affects other directories? Especially other visualization stuff, which often depends on externally installed systems?
Theoretically yes, but as far as I know, Inventor's the only external package that doesn't have CMake imported targets created when it's found (on the todo list). Any Geant4 -> Geant4 includes are consistent as each category/subcategory uses target_include_directories() to describe the paths they expose. Any problems here will immediately be picked up in Continuous and/or Nightly tests.
Just to close out - this was fixed in MR 782 on gitlab, and will be applied to the upcoming 10.6.1 patch.