Using Root 6-30-02 with CMake: Vdt connot be found

Dear All,

I’m using homebrew to install Root 6 on my Mac, and today I updated all my packages, and when I now want to recompile a script that uses root, that was working fine with the previous root version, I use CMake, I get the following error:

CMake Error at /opt/homebrew/Cellar/cmake/3.28.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Vdt (missing: VDT_INCLUDE_DIR VDT_LIBRARY)
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.28.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /opt/homebrew/Cellar/root/6.30.02/share/root/cmake/modules/FindVdt.cmake:63 (find_package_handle_standard_args)
  /opt/homebrew/Cellar/cmake/3.28.0/share/cmake/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
  /opt/homebrew/share/root/cmake/ROOTConfig.cmake:132 (find_dependency)
  CMakeLists.txt:46 (find_package)

I did a google search and I find that this VDT package is included in root for a long time already, but previously I had no problems with my cmake. I can’t install VDT with homebrew, so I don’t really know how to fix this issue.

Any ideas?

My CMake file looks like this:

# find rat-models library
find_package(RatModels 2.016.3 REQUIRED)
# find_package(Vdt REQUIRED)
find_package(ROOT 6.30 REQUIRED)
include_directories(${ROOT_INCLUDE_DIRS})

# set the model
add_executable(magdem magdem.cpp)
target_link_libraries(magdem Rat::Models ${ROOT_LIBRARIES})

_ROOT Version: 6.30
_Platform: MacOS
_Compiler: HomeBrew / CMake


This bug was solved a couple of days ago on master: VDT Finding Fix, master branch (2023.12.05.) by krasznaa · Pull Request #14178 · root-project/root · GitHub

Thanks! In that case I probably have to wait until homebrew updates Root as well…

Cheers,
Nikkie

Hi NikkieD,
Are you able to resolve the issue now? If so please let me know how you did it, I am having the same issue now. Thanks!

see also Fix `find_package(root)` with Homebrew. Fixes #14113 by bellenot · Pull Request #14474 · root-project/root · GitHub

Thanks for quick reply, I saw it but not sure which file I should modify to resolve the issue. My CMakeList.txt looks like this:

cmake_minimum_required(VERSION 3.5)
project(hipoio C CXX Fortran)
set(VERSION 1.0.0)

option(BUILD_FPIC "Build with -fPIC" ON)
option(BUILD_HIPOPY "Build python" OFF)
option(BUILD_EXAMPLES "Build examples programs" OFF)

if(BUILD_FPIC)
  set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

# Add modules to find find packages
set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
   ${PROJECT_SOURCE_DIR}/cmake)

# Add root support
list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
find_package(ROOT REQUIRED COMPONENTS RIO Net)

include(${ROOT_USE_FILE})
set(CMAKE_C_FLAGS "-O3")
set(CMAKE_CXX_FLAGS "-O3 ${ROOT_CXX_FLAGS}")

The workaround is to modify a file called ROOTConfig.cmake, first you need to find where it is located in your system.

Thanks modifying /root/6.30.02/share/root/cmake/ROOTConfig.cmake fixed my issue. Much appreciated!