CMAKE not installing *.pcm and .rootmap

Hello CMAKE experts,

I would like to know the “correct” way of getting the *.pcm and *.rootmap files installed when cmake installs the library to CMAKE_INSTALL_PREFIX/lib. I know I can tell cmake to do this with an explicit INSTALL_FILES() directive, but the code in RootMacros.cmake (around line 704) seems indicate this should be done by the ROOT macros. The confusion is that this particular bit of code only seems to do anything when CMAKE_LIBRARY_OUTPUT_DIRECTORY is set, which it usually is not. So how should the install step be setup correctly?

Also, what is the correct place for ROOT + cmake information?
There is quite a bit of cmake advice on this forum and at various web location that contradict each other and may not work depending on the version of ROOT you are using. The page: Integrating ROOT into CMake projects - ROOT is rather incomplete, it does not mention ROOT_GENERATE_DICTIONARY. The website: ROOT · Modern CMake does much better, bit it still includes RootNewMacros.cmake, and does not help with getting the install step to work properly. From this forum: How to Integrate ROOT into my project with CMake does not have the ROOT_GENERATE_DICTIONARY after the “add_library”. And none of these resources show anything about the install step of the library.

I recognize it is difficult to document a changing project, but some clarification would be helpful.

Thanks!


The relevant part of RootMacros.cmake is here:

  if(NOT ARG_NOINSTALL AND NOT CMAKE_ROOTTEST_DICT AND DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
    ROOT_GET_INSTALL_DIR(shared_lib_install_dir)
    # Install the C++ module if we generated one.
    if (cpp_module_file)
      install(FILES ${cpp_module_file}
                    DESTINATION ${shared_lib_install_dir} COMPONENT libraries)
    endif()

    if(ARG_STAGE1)
      install(FILES ${rootmap_name}
                    DESTINATION ${shared_lib_install_dir} COMPONENT libraries)
    else()
      install(FILES ${pcm_name} ${rootmap_name}
                    DESTINATION ${shared_lib_install_dir} COMPONENT libraries)
    endif()
  endif()

_ROOT Version: git master
_Platform: MacOS
_Compiler: llvm
_cmake version: 3.22.2


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