Hi all,
I have been struggling a bit lately with trying to build applications using geant4 and ROOT in various institutional environments, and it’s made it evident that I don’t really know what’s happening under the hood of the build. I would appreciate any tips anyone has on where ROOT/CMake are finding various things when linking applications.
For example, right now I’m trying to build an application on a Fermilab virtual machine. Before starting, I setup cmake and my desired ROOT version:
source /grid/fermiapp/products/common/etc/setup
export PRODUCTS=${PRODUCTS}:/grid/fermiapp/products/larsoft
setup -f Linux64bit+2.6-2.12 -q debug:e9:nu root v6_04_06
setup cmake
Then I have a CMakeLists.txt that uses:
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} /grid/fermiapp/products/larsoft/root/v6_04_06/source/root-6.04.06/etc/cmake)
find_package(ROOT MODULE REQUIRED Cling TreePlayer)
include(${ROOT_USE_FILE})
message(STATUS "Environmental ROOTSYS is $ENV{ROOTSYS}")
message(STATUS "found root at: ${ROOT_USE_FILE}")
message(STATUS "ROOT_LIBRARIES=${ROOT_LIBRARIES}")
target_link_libraries(wchsandbox ${ROOT_LIBRARIES})
However, this ends up returning the following:
-- Environmental ROOTSYS is /grid/fermiapp/products/larsoft/root/v6_04_06/Linux64bit+2.6-2.12-e9-nu-debug
-- found root at: /grid/fermiapp/products/larsoft/root/v6_04_06/source/root-6.04.06/etc/cmake/RootUseFile.cmake
-- ROOT_LIBRARIES=/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libCore.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libCint.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libRIO.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libNet.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libHist.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libGraf.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libGraf3d.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libGpad.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libTree.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libRint.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libPostscript.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libMatrix.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libPhysics.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libMathCore.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libThread.so;/grid/fermiapp/products/larsoft/root/v6_04_06/Linux64bit+2.6-2.12-e9-nu-debug/lib/libCling.so;/grid/fermiapp/products/genie/externals/root/v5_34_25a/Linux64bit+2.6-2.12-e7-nu-debug/lib/libTreePlayer.so
ROOTSYS - OK,
ROOT_USE_FILE - OK
ROOT_LIBRARIES - … somehow cmake has instead dug up an old Root 5.34 version from the depths of obscurity?!
Everything I can find in FindROOT.cmake and RootUseFile.cmake reference ROOTSYS, which is correctly pointing to the v6 folder… where is it getting this? And more importantly, how do I make it use the ROOT version I’m specifying?
Thanks in advance again folks,
Marcus