Promoting the new way
This commit is contained in:
parent
674c784bf0
commit
92598e53e1
@ -13,13 +13,6 @@ ROOT 6.10+ supports config file discovery, so you can just do:
|
|||||||
|
|
||||||
to attempt to find ROOT. If you don't have your paths set up, you can pass `-DROOT_DIR=$ROOTSYS/cmake` to find ROOT. (But, really, you should source `thisroot.sh`).
|
to attempt to find ROOT. If you don't have your paths set up, you can pass `-DROOT_DIR=$ROOTSYS/cmake` to find ROOT. (But, really, you should source `thisroot.sh`).
|
||||||
|
|
||||||
## The too-simple way
|
|
||||||
|
|
||||||
ROOT [provides a utility](https://root.cern.ch/how/integrate-root-my-project-cmake) to set up a ROOT project, which you can activate using `include("${ROOT_USE_FILE}")`. This will automatically make ugly directory level and global variables for you. It will save you a little time setting up, and will waste massive amounts of time later if you try to do anything tricky. As long as you aren't making a library, it's probably fine for simple scripts. Includes and flags are set globally, but you'll still need to link to `${ROOT_LIBRARIES}` yourself, along with possibly `ROOT_EXE_LINKER_FLAGS` (You will have to `separate_arguments` first before linking or you will get an error if there are multiple flags, like on macOS). Also, before 6.16, you have to manually fix a bug in the spacing.
|
|
||||||
|
|
||||||
Here's what it would look like:
|
|
||||||
|
|
||||||
[import:'core', lang:'cmake'](../../examples/root-usefile/CMakeLists.txt)
|
|
||||||
|
|
||||||
## The right way (Targets)
|
## The right way (Targets)
|
||||||
|
|
||||||
@ -51,6 +44,14 @@ If you'd like to see the default list, run `root-config --libs` on the command l
|
|||||||
* `ROOT::TreePlayer`
|
* `ROOT::TreePlayer`
|
||||||
* `ROOT::Tree`
|
* `ROOT::Tree`
|
||||||
|
|
||||||
|
## The old global way
|
||||||
|
|
||||||
|
ROOT [provides a utility](https://root.cern.ch/how/integrate-root-my-project-cmake) to set up a ROOT project, which you can activate using `include("${ROOT_USE_FILE}")`. This will automatically make ugly directory level and global variables for you. It will save you a little time setting up, and will waste massive amounts of time later if you try to do anything tricky. As long as you aren't making a library, it's probably fine for simple scripts. Includes and flags are set globally, but you'll still need to link to `${ROOT_LIBRARIES}` yourself, along with possibly `ROOT_EXE_LINKER_FLAGS` (You will have to `separate_arguments` first before linking or you will get an error if there are multiple flags, like on macOS). Also, before 6.16, you have to manually fix a bug in the spacing.
|
||||||
|
|
||||||
|
Here's what it would look like:
|
||||||
|
|
||||||
|
[import:'core', lang:'cmake'](../../examples/root-usefile/CMakeLists.txt)
|
||||||
|
|
||||||
## Components
|
## Components
|
||||||
|
|
||||||
Find ROOT allows you to specify components. It will add anything you list to `${ROOT_LIBRARIES}`, so you might want to build your own target using that to avoid listing the components twice. This did not solve dependencies; it was an error to list `RooFit` but not `RooFitCore`. If you link to `ROOT::RooFit` instead of `${ROOT_LIBRARIES}`, then `RooFitCore` is not required.
|
Find ROOT allows you to specify components. It will add anything you list to `${ROOT_LIBRARIES}`, so you might want to build your own target using that to avoid listing the components twice. This did not solve dependencies; it was an error to list `RooFit` but not `RooFitCore`. If you link to `ROOT::RooFit` instead of `${ROOT_LIBRARIES}`, then `RooFitCore` is not required.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user