Bringing (part) of ROOT in a project using FetchContent?

Dear all,

Is it in principle possible to bring in (part of) ROOT in a CMake-based project using FetchContent ?

Trying this in my dependencies.cmake file :

FetchContent_Declare(ROOT
   URL https://root.cern/download/root_v6.30.04.source.tar.gz
   FIND_PACKAGE_ARGS)

The first error I get is :

CMake Error at build-dev/_deps/root-src/cmake/modules/SetROOTVersion.cmake:21 (file):
  file failed to open for reading (No such file or directory):

    /Users/laurent/git.km3net.de/laphecetche/toashort-formats/core/foundation/inc/ROOT/RVersion.hxx
Call Stack (most recent call first):
  build-dev/_deps/root-src/cmake/modules/SetROOTVersion.cmake:45 (SET_VERSION_FROM_FILE)
  build-dev/_deps/root-src/cmake/modules/SetROOTVersion.cmake:99 (SET_ROOT_VERSION)
  build-dev/_deps/root-src/CMakeLists.txt:77 (include)

Seeing the path that is looked for (the top project that is trying to bring Root as a dependency with FetchContent and not Root project) I suspect Root is not 100% ready to be included like that (e.g. SetROOTVersion.cmake is using CMAKE_SOURCE_DIR while probably it should use PROJECT_SOURCE_DIR ?), but would like a confirmation :wink:

Hi, I never tried that. Maybe @amadio knows more

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.