Discussion:
Using ROOT from another application with cmake
Marcelo Zimbres
2014-09-15 12:53:39 UTC
Permalink
Hi,

I see one can find the macro root.m4 in the ROOT distribution, to find
ROOT with autotools. Do you also provide a similar file to find ROOT
with cmake?

Regrads,
Marcelo
Marcelo Zimbres
2014-09-15 13:19:01 UTC
Permalink
Hi, I have just found the necessary cmake files to find ROOT from my
application. I have used the files:

root/etc/cmake/FindROOT.cmake
root/cmake/modules/CMakeMacroParseArguments.cmake

Copying these two files to my application and using
"find_package(ROOT)" was enough to find root and set the appropriate
variables.

Wouldn't it be better to have these files in the root/build/misc
directory just as root.m4 for autotools?

Regards,
Marcelo
Post by Marcelo Zimbres
Hi,
I see one can find the macro root.m4 in the ROOT distribution, to find
ROOT with autotools. Do you also provide a similar file to find ROOT
with cmake?
Regrads,
Marcelo
Stefano Caiazza
2014-09-15 13:39:31 UTC
Permalink
Actually, as far as I know, those are the default folder pattern where cmake should find his configuration files.

Best
Stefano

-----Original Message-----
From: Marcelo Zimbres [mailto:***@gmail.com]
Sent: Monday, September 15, 2014 3:19 PM
To: roottalk (Mailing list for ROOT users.)
Subject: Re: Using ROOT from another application with cmake

Hi, I have just found the necessary cmake files to find ROOT from my application. I have used the files:

root/etc/cmake/FindROOT.cmake
root/cmake/modules/CMakeMacroParseArguments.cmake

Copying these two files to my application and using "find_package(ROOT)" was enough to find root and set the appropriate variables.

Wouldn't it be better to have these files in the root/build/misc directory just as root.m4 for autotools?

Regards,
Marcelo
Post by Marcelo Zimbres
Hi,
I see one can find the macro root.m4 in the ROOT distribution, to find
ROOT with autotools. Do you also provide a similar file to find ROOT
with cmake?
Regrads,
Mar
Pere Mato Vila
2014-09-15 14:39:36 UTC
Permalink
Hi Marcelo,

If you have ROOT with CMake (see instructions at http://root.cern.ch/drupal/content/building-root-cmake) then the way to build a CMake project using ROOT is by using in your CMakeLists.txt

find_package(ROOT COMPONENTS Hist Tree)
include(${ROOT_USE_FILE})

The first command defines the variables ROOT_INCLUDE_DIRS and ROOT_LIBRARIES to be used in your builds. For example:

include_directories(${ROOT_INCLUDE_DIRS})

The second command defines a number of useful macros and functions to build libraries, executables, dictionaries, etc. When you configure your project you need to tell were to find ROOT. One way of doing it is by setting the variable CMAKE_PREFIX_PATH to the location of the ROOT installation (e.g. ${ROOTSYS}).

Tell me if you have any problem with it. Cheers,

Pere
Post by Marcelo Zimbres
Hi,
I see one can find the macro root.m4 in the ROOT distribution, to find
ROOT with autotools. Do you also provide a similar file to find ROOT
with cmake?
Regrads,
Marcelo
Loading...