Hi,
I use ROOT 5.34 windows distribution (root_v5.34.34.win32.vc12.zip) and would like to compile my own program which use Geant4 and root libs. I add to my CMakeLists.txt lines
…
find_package(ROOT REQUIRED)
…
include_directories(${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR}
${ROOT_INCLUDE_DIRS})
…
target_link_libraries(exampleN06 ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
…
Using this all Geant4 staff are founded and added, but ROOT libs are missing. cmake didnt find any ROOT libs and explicitly ask me only about cint and core lib. I dig over ROOTConfig.cmake file and found
set(ROOT_LIBRARIES)
foreach(cpt Core Cint ${ROOT_FIND_COMPONENTS})
find_library(ROOT${_cpt}_LIBRARY ${cpt} HINTS ${ROOT_LIBRARY_DIR})
if(ROOT${_cpt}LIBRARY)
mark_as_advanced(ROOT${_cpt}LIBRARY)
list(APPEND ROOT_LIBRARIES ${ROOT${_cpt}_LIBRARY})
list(REMOVE_ITEM ROOT_FIND_COMPONENTS ${_cpt})
endif()
endforeach()
seems that ROOT_FIND_COMPONENTS var are not filled properly on windows. So I use “dirty hack” and add
set(ROOT_FIND_COMPONENTS Cint Reflex genmap Cintex Rint Thread rootcint rlibmap Core rmkdepend bindexplib MathCore MathMore Matrix Minuit Minuit2 Fumili Physics MLP Quadp Foam Smatrix SPlot GenVector Genetic Unuran Hist HistPainter Spectrum SpectrumPainter Tree TreePlayer TreeViewer RIO SQLIO XMLIO Net RootAuth RHTTP Gpad Graf Postscript mathtext Win32gdk ASImage ASImageGui Graf3d Eve RGL GLEW FTGL Gviz3d Gui Ged FitPanel GuiBld GuiHtml Recorder SessionViewer Proof ProofPlayer ProofDraw Html EG VMC EGPythia8 Geom GeomBuilder GeomPainter Gdml Table root.exe proofserv.exe hadd PyROOT RODBC TMVA RooFitCore RooFit RooStats)
to ROOTConfig.cmake just before set(ROOT_LIBRARIES). Now cmake began to ask me about all ROOT libs and still not finding them himself. So I make a copy of all ROOT libs with windows name style, like
libCore.lib -> Core.lib
…
and now cmake find all nessesary staff himself and my program compiles and run. My questions is how to do this in more “elegant” way, without modifying and renaming ROOT files?
Thanks,
Denis