I had to introduce few changes in my cmake/FindGarfield.cmake so that cmake is able to find Garfield.
In particular, the latest Garfield in their master branch changes the include/ directory by include/Garfield/.
But also, I was surprised that I need to add ENV statement in GARFIELD_HOME so that it uses the environment external GARFIELD_HOME definition that we have to add to our bashrc together with other HEED path definitions.
set(Garfield_DIR $ENV{GARFIELD_HOME})
My question is, was this working before without ENV under other conditions/system?
I have made the following commit to the development branch
I have indeed include/Garfield/ in my distribution. But I also have Include w/ a capital I, which
has the same contents. FindGarfield.cmake retrieves the latter.
But I have another problem,viz. cmake does not find heed++, so that I have to edit FindGarfield.cmake to get it:
W/o the patch that adds garfield/Heed to ${external_include_dirs}, I get the following fatal
error at compilation time:
[ 29%] Building CXX object source/metadata/CMakeFiles/RestMetadata.dir/general/src/TRestGas.cxx.o
In file included from /local/home/ybedfer/REST/REST_v2.2.11_dev/source/metadata/general/inc/TRestGas.h:49:0,
from /local/home/ybedfer/REST/REST_v2.2.11_dev/source/metadata/general/src/TRestGas.cxx:216:
/local/home/ybedfer/software/garfield/Include/TrackHeed.hh:10:42: fatal error: heed++/code/HeedCondElectron.h: No such file or directory
compilation terminated.
source/metadata/CMakeFiles/RestMetadata.dir/build.make:381: recipe for target 'source/metadata/CMakeFiles/RestMetadata.dir/general/src/TRestGas.cxx.o' failed
make[2]: *** [source/metadata/CMakeFiles/RestMetadata.dir/general/src/TRestGas.cxx.o] Error 1
CMakeFiles/Makefile2:237: recipe for target 'source/metadata/CMakeFiles/RestMetadata.dir/all' failed
The price to pay being the following bad statement in thisREST.sh:
I have been recently trying to install Garfield and I detected another problem in FindGarfield.cmake. It was not finding the Garfield_INCLUDE_DIRS path i.e. this part of the code was not working:
Yes, I remember experiencing this problem before, specially when Garfield source directories changed between one Garfield version and another, that’s why there are so many HINTS.
But It is strange it does not find it. Because ${Garfield_DIR}/Include/ is present on the HINTS.
I imagine you have GARFIELD_HOME defined?
It found it for me without problems when running cmake ../.
I imagine you were getting errors already during cmake execution?
It is weird because I encountered this problem when installing REST in my own computer. When I installed it at another machine however, there was no problem at all. So maybe is something related to my local computer… sorry!