Hi everyone,
I am building a small project with the following structure with CMake:
├── App
│ ├── App.cxx
│ └── CMakeLists.txt
├── Reconstruction
│ ├── CMakeLists.txt
│ ├── inc
│ └── src
├── More_Folders
│ ├── CMakeLists.txt
│ ├── inc
│ └── src
└── CMakeLists.txt
In the Reconstruction folder, I define dictionaries to write and read custom defined classes. My Reconstruction/CMakeLists.txt is very basic:
# Add source files
file(GLOB SOURCES "src/*.cxx")
# Add a library target
add_library(ReconstructionLibrary ${SOURCES})
# Set include directories for library target
target_include_directories(ReconstructionLibrary PUBLIC inc)
# Generate ROOT dictionary
root_generate_dictionary(Reconstruction_dict inc/dEdx.h LINKDEF inc/Recon_LinkDef.h MODULE ReconstructionLibrary)
root_generate_dictionary(ERAMinfo_dict inc/LUTs.h LINKDEF inc/Recon_LinkDef.h MODULE ReconstructionLibrary)
# Link the ROOT dictionary to the library
target_link_libraries(ReconstructionLibrary PUBLIC MiscLibrary SignalModelLibrary EvtModelLibrary FittersLibrary SampleToolsLibrary EvtModelToolsLibrary)
This library is then linked to the executable in the App directory with this very short App/CMakeLists.txt:
add_executable(App App.cxx)
target_link_libraries(App MiscLibrary SignalModelLibrary EvtModelLibrary FittersLibrary SampleToolsLibrary EvtModelToolsLibrary ReconstructionLibrary ${ROOT_LIBRARIES})
Eventually, the top-level CMakeLists.txt is as follow:
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(dEdxRecon)
find_package(ROOT REQUIRED COMPONENTS RIO Tree)
include_directories(${ROOT_INCLUDE_DIRS})
# Add subdirectories
add_subdirectory(App)
add_subdirectory(Reconstruction)
add_subdirectory(Other_folders)
However, after compilation, during the execution of the code, I get the following error:
Error in <TCling::LoadPCM>: ROOT PCM path_to_workspace/build/App/libReconstructionLibrary_rdict.pcm file does not exist
since the rdict.pcm files are created in the build/Reconstruction folder, not the App one. I believe this is related to this thread, even though I couldn’t solve it.
What should I change so that TCling does not look for the PCM files in the build/App folder but rather in the build/Reconstruction folder, where they were actually created?
Cheers,
Tristan
ROOT Version: 6.30/04