TSAXParser.h not found while building app with ROOT dependency


_ROOT Version: v6-33-01
Platform: Ubuntu 20.04 on Windows (WSL)
Compiler: gcc/g++ I think…?


Hello,
I’m trying to install an application called musrfit, (Setting up musrfit on Different Platforms — musrfit 1.9.5 documentation) and I’m running into a problem while I’m building the file.

Here is the code and error message that pop up:

sudo cmake --build ./ --clean-first
... (Files being built)
[  7%] Generating PRgeHandlerDict.cxx, libPRgeHandler_rdict.pcm, libPRgeHandler.rootmap
[  8%] Linking CXX executable msr2msr
input_line_9:41:10: fatal error: 'TSAXParser.h' file not found
#include "TSAXParser.h"
         ^~~~~~~~~~~~~~
Error: /usr/local/bin/rootcling: compilation failure (/home/discus/Apps/musrfit/build/src/classes/libPUserFcnBasee5215e2124_dictUmbrella.h)
make[2]: *** [src/classes/CMakeFiles/PUserFcnBase.dir/build.make:77: src/classes/PUserFcnBaseDict.cxx] Error 1
make[1]: *** [CMakeFiles/Makefile2:959: src/classes/CMakeFiles/PUserFcnBase.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

It cannot find TSAXParser.h. This is a library(?) that is mentioned in a lot of the files in ROOT, so I don’t know if this is something I need to install separately or if root has some map or header file (I don’t know the term) that tells it where this file is that musrfit does not have, or if building musr is calling ROOT information and then ROOT is having an error.

Root does run when I call it.

I’m not even sure if this is a problem with root or something else, but the installation documentation for the application musrfit doesn’t seem to suggest there’s any sort

Thank you for any insight and help you can provide,

Hi Samuel,

I am sorry to read this compilation against ROOT is not working out of the box.
Maybe can you be more precise about what command is failing, i.e. rootcling exact invocation?

Best,
D

In your CMakeLists, did you call
target_link_libraries(....... PRIVATE ROOT::XMLParser)

I’m not quite sure how or where to check that. I’m afraid I’m quite the beginner when it comes to linux systems. If you have any advice as to what to check to figure that out, I’d be quite appreciative.

If I’ve found the right file (CMakeLists.txt in my musrfit folder, which gets auto-written some of the previous commands I think), it doesn’t call that function. It only mentions XMLParser once, in the command
find_package(ROOT 6.18 REQUIRED COMPONENTS Gui MathMore Minuit2 XMLParser)

Is there a specific place I should edit in that command to?

Later on in that file, there should be the definition of your program name or library.

After that line, you need to write

target_link_libraries(yourProgramName PUBLIC ROOT::XMLParser)

Thank you for the advice.

I’m not particularly sure where that is, looking at it. If you can help, I’ll list some spots in the code that seem similar to what you’ve described.

First, above this, rather than later, there’s the spot where it declares the project with the code:
project(musrfit VERSION 1.9.5 LANGUAGES C CXX)
I’d guess this is it, but you did write “later on” so I’m not sure if that’s right or not.

The find_package command was in a block of code commented as “Check for ROOT”. There’s a lot of other “Check for package” code blocks similar to this.

There’s a block commented as “RPath related things”
There’s then a command add_subdirectory(src)
And then it’s a command to write a summary of the installation.

I can also just post the whole file here:

cmake_minimum_required(VERSION 3.17)

project(musrfit VERSION 1.9.5 LANGUAGES C CXX)

#--- musrfit specific options -------------------------------------------------
option(nexus "build optional NeXus support. Needed for ISIS" OFF)
option(ASlibs "build optional ASlibs" OFF)
option(BMWlibs "build optional BMWlibs" OFF)
option(BNMRlibs "build optional beta-NMR libs" OFF)
option(DummyUserFcn "build optional dummy user function" OFF)
option(qt_based_tools "try to install Qt based tools (musredit, musrWiz, musrStep, mupp)" ON)
option(try_OpenMP "try to use OpenMP if available" ON)
# define qt_version with possible values 'auto' or version '3', '4', '5', '6'
set(qt_version AUTO CACHE STRING "provide a specific Qt version to be used.")
set_property(CACHE qt_version PROPERTY STRINGS AUTO 3 4 5 6)

#--- set a default build type if none was specified ---------------------------
set(default_build_type "Release")

if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
  set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
      STRING "Choose the type of build." FORCE)
  # Set the possible values of build type for cmake-gui
  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
    "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif ()

#--- perform some checks and generate the config.h ----------------------------

#--- the next two lines are needed that the math functions are found ----------
set(CMAKE_REQUIRED_INCLUDES math.h)
set(CMAKE_REQUIRED_LIBRARIES m)

include(CheckTypeSize)
include(CheckIncludeFiles)
include(CheckFunctionExists)
check_include_files(alloca.h HAVE_ALLOCA_H)
check_include_files("sys/ipc.h;sys/shm.h" HAVE_SHMGET)
check_include_files(dlfcn.h HAVE_DLFCN_H)
check_function_exists(erf HAVE_ERF)
check_function_exists(getloadavg HAVE_GETLOADAVG)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(memory.h HAVE_MEMORY_H)
check_function_exists(powl HAVE_POWL)
check_include_files(memory.h HAVE_MEMORY_H)
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(stdlib.h HAVE_STDLIB_H)
check_include_files(string.h HAVE_STRING_H)
check_include_files(strings.h HAVE_STRINGS_H)
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
check_include_files(sys/unistd.h HAVE_UNISTD_H)
check_type_size("long double" LONG_DOUBLE)
check_type_size("double" DOUBLE)
if (${LONG_DOUBLE} GREATER ${DOUBLE})
  set(HAVE_LONG_DOUBLE 1)
  set(HAVE_LONG_DOUBLE_WIDER 1)
endif (${LONG_DOUBLE} GREATER ${DOUBLE})

#--- check for all the needed packages ----------------------------------------

#--- add path to my own find modules and other stuff
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

#--- check for pkg-config -----------------------------------------------------
find_package(PkgConfig REQUIRED)

#--- check for git ------------------------------------------------------------
find_package(Git REQUIRED)

#--- check for ROOT -----------------------------------------------------------
find_package(ROOT 6.18 REQUIRED COMPONENTS Gui MathMore Minuit2 XMLParser)
if (ROOT_mathmore_FOUND)
  execute_process(COMMAND root-config --bindir OUTPUT_VARIABLE ROOT_BINDIR)
  string(STRIP ${ROOT_BINDIR} ROOT_BINDIR)
  execute_process(COMMAND root-config --version OUTPUT_VARIABLE ROOT_VERSION)
  string(STRIP ${ROOT_VERSION} ROOT_VERSION)
  message("-- Found ROOT: ${ROOT_BINDIR} (found version: ${ROOT_VERSION})")
  #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
  include(${ROOT_USE_FILE})
endif (ROOT_mathmore_FOUND)

#--- the next check is need to set a flag, since root 6.24 (minuit2) breaks
#--- the backwards compatibility. ---------------------------------------------
if (ROOT_VERSION VERSION_LESS "6.23")
  set(ROOT_GRTEQ_24 0)
else ()
  set(ROOT_GRTEQ_24 1)
endif ()
set(ROOT_GRTEQ_24 ${ROOT_GRTEQ_24} CACHE INTERNAL "ROOT Version check")

#--- check for boost ----------------------------------------------------------
find_package(Boost REQUIRED
  COMPONENTS
    system
    filesystem
)
message(STATUS "Boost libs: ${Boost_LIBRARIES}")

#--- check for gsl ------------------------------------------------------------
find_package(GSL REQUIRED)

#--- check for fftw3 ----------------------------------------------------------
find_package(FFTW3 REQUIRED)

#--- check for libxml2 --------------------------------------------------------
find_package(LibXml2 REQUIRED)

#--- check for OpenMP ---------------------------------------------------------
if (try_OpenMP)
  find_package(OpenMP)
  if (OpenMP_CXX_FOUND)
    add_definitions(-DHAVE_GOMP)
    set(HAVE_GOMP 1 CACHE INTERNAL "Have GOMP")
  endif (OpenMP_CXX_FOUND)
endif (try_OpenMP)

#--- check for Qt -------------------------------------------------------------
if (qt_based_tools)
  # check for any Qt, i.e. AUTO
  if (qt_version STREQUAL AUTO)
    # try Qt6
    find_package(Qt6Core QUIET)
    if (Qt6Core_FOUND)
      find_package(Qt6Widgets CONFIG REQUIRED)
      find_package(Qt6Xml CONFIG REQUIRED)
      find_package(Qt6Network CONFIG REQUIRED)
      find_package(Qt6Svg CONFIG REQUIRED)
      find_package(Qt6PrintSupport CONFIG REQUIRED)
    endif (Qt6Core_FOUND)
    # try Qt5
    if (NOT Qt6Core_FOUND)
      find_package(Qt5Core QUIET)
      if (Qt5Core_FOUND)
        find_package(Qt5Widgets CONFIG REQUIRED)
        find_package(Qt5Xml CONFIG REQUIRED)
        find_package(Qt5Network CONFIG REQUIRED)
        find_package(Qt5Svg CONFIG REQUIRED)
        find_package(Qt5PrintSupport CONFIG REQUIRED)
      endif (Qt5Core_FOUND)
    endif (NOT Qt6Core_FOUND)

    # if Qt6 and Qt5 is not found, try Qt4
    if (NOT Qt6Core_FOUND AND NOT Qt5Core_FOUND)
      find_package(Qt4 COMPONENTS QtGui QtWebKit QtXml)
    endif (NOT Qt6Core_FOUND AND NOT Qt5Core_FOUND)

    # if Qt6, Qt5 and Qt4 is not found try Qt3. Hopefully you never reach this point
    if (NOT Qt6Core_FOUND AND NOT Qt5Core_FOUND AND Qt4_FOUND)
      find_package(Qt3)
    endif (NOT Qt6Core_FOUND AND NOT Qt5Core_FOUND AND Qt4_FOUND)
  endif (qt_version STREQUAL AUTO)

  # check specifically for Qt6
  if (qt_version STREQUAL 6)
    find_package(Qt6Core)
    if (Qt6Core_FOUND)
      find_package(Qt6Widgets CONFIG REQUIRED)
      find_package(Qt6Xml CONFIG REQUIRED)
      find_package(Qt6Network CONFIG REQUIRED)
      find_package(Qt6Svg CONFIG REQUIRED)
      find_package(Qt6PrintSupport CONFIG REQUIRED)
    else (Qt6Core_FOUND)
      message(FATAL_ERROR "Couldn't find the specifically requested Qt6 version.")
    endif (Qt6Core_FOUND)
  endif (qt_version STREQUAL 6)

 # check specifically for Qt5
  if (qt_version STREQUAL 5)
    find_package(Qt5Core)
    if (Qt5Core_FOUND)
      find_package(Qt5Widgets CONFIG REQUIRED)
      find_package(Qt5Xml CONFIG REQUIRED)
      find_package(Qt5Network CONFIG REQUIRED)
      find_package(Qt5Svg CONFIG REQUIRED)
      find_package(Qt5PrintSupport CONFIG REQUIRED)
    else (Qt5Core_FOUND)
      message(FATAL_ERROR "Couldn't find the specifically requested Qt5 version.")
    endif (Qt5Core_FOUND)
  endif (qt_version STREQUAL 5)

  # check specifically for Qt4
  if (qt_version STREQUAL 4)
    find_package(Qt4 COMPONENTS QtGui QtWebKit QtXml)
    if (NOT Qt4_FOUND)
      message(FATAL_ERROR "Couldn't find the specifically requested Qt4 version.")
    endif (NOT Qt4_FOUND)
  endif (qt_version STREQUAL 4)

  # check specifically for Qt3
  if (qt_version STREQUAL 3)
    find_package(Qt3)
    if (NOT QT_FOUND)
      message(FATAL_ERROR "Couldn't find the specifically requested Qt3 version.")
    endif (NOT QT_FOUND)
  endif (qt_version STREQUAL 3)
endif (qt_based_tools)

#--- if NeXus check also for HDF4, HDF5, and MXML -----------------------------
if (nexus)
  find_package(HDF5 COMPONENTS CXX REQUIRED )
  find_package(HDF4 REQUIRED)
  find_package(NEXUS REQUIRED)
  add_definitions(-DPNEXUS_ENABLED)
endif (nexus)

#--- check for Cuba lib if BMWlibs are enabled --------------------------------
#//as35 probably always stick to the internal one ...

#--- all checks done -> feed config.h -----------------------------------------
set(HAVE_CONFIG_H 1 CACHE INTERNAL "config.h is available")
configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)

#--- check if project source is a git repo ------------------------------------
if (EXISTS "${CMAKE_SOURCE_DIR}/.git/HEAD")
  message(STATUS "is a git repo")
  set(IS_GIT_REPO 1)
else ()
  message(STATUS "is NOT a git repo")
  set(IS_GIT_REPO 0)
endif ()

#--- rpath related things -----------------------------------------------------
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)

# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# the RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
    set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif("${isSystemDir}" STREQUAL "-1")
set(rpath ${CMAKE_INSTALL_RPATH})
string(APPEND rpath ";/usr/local/lib")
set(CMAKE_INSTALL_RPATH "${rpath}")

#--- propagate to the sub-directories -----------------------------------------
add_subdirectory(src)

#--- write summary of the installation
cmake_host_system_information(RESULT PROCESSOR QUERY PROCESSOR_DESCRIPTION)

message("")
message("|-----------------------------------------------------------------------|")
message("|                                                                       |")
message("|                            Summary                                    |")
message("|                                                                       |")
message("|-----------------------------------------------------------------------|")
message("")
message(" System:    ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR} - ${CMAKE_HOST_SYSTEM_VERSION}")
message(" Processor: ${PROCESSOR} (${CMAKE_SYSTEM_PROCESSOR})")
message(" ----------")
message("")
message(" musrfit Version: ${musrfit_VERSION}")
message(" ----------------")
message("")
message(" Build Type: ${CMAKE_BUILD_TYPE}")
message(" -----------")
message("")
message(" Requirements:")
message(" -------------")
message("")
message(" FFTW3   found in ${FFTW3_INCLUDE}, Version: ${FFTW_VERSION}")
message(" GSL     found in ${GSL_INCLUDE_DIRS}, Version: ${GSL_VERSION}")
message(" BOOST   found in ${Boost_INCLUDE_DIRS}, Version: ${Boost_VERSION}")
message(" LibXML2 found in ${LIBXML2_INCLUDE_DIR}, Version: ${LIBXML2_VERSION_STRING}")
message(" ROOT    found in ${ROOT_INCLUDE_DIRS}, Version: ${ROOT_VERSION}")
if (OpenMP_FOUND)
  if (OpenMP_CXX_VERSION)
    message(" OpenMP  found Version: ${OpenMP_CXX_VERSION}")
  else (OpenMP_CXX_VERSION)
    message(" OpenMP  found")
  endif (OpenMP_CXX_VERSION)
endif (OpenMP_FOUND)

if (nexus)
  message("")
  message(" HDF4    found in ${HDF4_INCLUDE_DIRS}")
  message(" HDF5    found in ${HDF5_INCLUDE_DIRS}, Version: ${HDF5_VERSION}")
  message(" NeXus   found in ${NEXUS_INCLUDE_DIR}, Version: ${NEXUS_VERSION_STRING}")
endif (nexus)

message("")
if (qt_based_tools)
  if (Qt6Core_FOUND)
    message(" Qt      found in  ${Qt6Core_INCLUDE_DIRS}, Version: ${Qt6Core_VERSION}")
  else (Qt6Core_FOUND)
    if (Qt5Core_FOUND)
      message(" Qt      found in  ${Qt5Core_INCLUDE_DIRS}, Version: ${Qt5Core_VERSION}")
    else (Qt5Core_FOUND)
      if (Qt4_FOUND)
        message(" Qt      found Version: ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
      else (Qt4_FOUND)
        if (QT_FOUND)
          message(" Qt      found Version: ${QT_VERSION}")
        endif (QT_FOUND)
      endif (Qt4_FOUND)
    endif (Qt5Core_FOUND)
  endif (Qt6Core_FOUND)
endif (qt_based_tools)
message("")
message(" Features:")
message(" ---------")
message("")
message(" Supported muSR file formates:")
message("   MusrRoot                           : yes")
message("   ROOT (LEM)                         : yes")
message("   MUD (triumf)                       : yes")
message("   PSI-BIN                            : yes")
message("   PSI-MDU                            : yes")
message("   WKM (deprecated)                   : yes")
if (nexus)
  message("   NeXus                              : yes")
else (nexus)
  message("   NeXus                              : no")
endif (nexus)

message("")
message(" External user-function libraries:")
if (ASlibs)
  message("   ASlibs                             : yes")
else (ASlibs)
  message("   ASlibs                             : no")
endif (ASlibs)
if (BMWlibs)
  message("   BMWlibs                            : yes")
else (BMWlibs)
  message("   BMWlibs                            : no")
endif (BMWlibs)
if (BNMRlibs)
  message("   BNMRlibs                           : yes")
else (BNMRlibs)
  message("   BNMRlibs                           : no")
endif (BNMRlibs)
if (DummyUserFcn)
  message("   PDummyUserFcn                      : yes")
endif (DummyUserFcn)

if (qt_based_tools)
if (Qt6Core_FOUND)
  message("")
  message(" Qt6 based tools:")
  message("   musredit, musrStep, musrWiz, mupp  : yes")
elseif (Qt5Core_FOUND)
  message("")
  message(" Qt5 based tools:")
  message("   musredit, musrStep, musrWiz, mupp  : yes")
elseif (Qt4_FOUND)
  message("")
  message(" Qt4 based tools (deprecated):")
  message("   musredit                           : yes")
else ()
  message("")
  message(" Qt3 based tools (outdated):")
  message("   musrgui                            : yes")
endif ()
if (NOT Qt6Core_FOUND AND NOT Qt5Core_FOUND AND NOT Qt4_FOUND AND NOT QT_FOUND)
  message("")
  message(" NO Qt based tools will be installed since Qt is not found or not installed on the system")
endif (NOT Qt6Core_FOUND AND NOT Qt5Core_FOUND AND NOT Qt4_FOUND AND NOT QT_FOUND)
else (qt_based_tools)
  message("")
  message(" Qt based tools (musredit, musrStep, musrWiz, mupp) have been disabled")
endif (qt_based_tools)
message("")
message(" Installation directories:")
message(" -------------------------")
message("")
message(" Programs                : ${CMAKE_INSTALL_PREFIX}/bin")
message(" XML configuration files : " $ENV{HOME} "/.musrfit")
message(" Documentation           : ${CMAKE_INSTALL_PREFIX}/share/doc/musrfit")
message("")
message("-------------------------------------------------------------------------")
message("")

#--- cpack specific info ......................................................
file(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} PROJECT_SOURCE_DIR_NATIVE)
file(TO_NATIVE_PATH ${PROJECT_BINARY_DIR} PROJECT_BINARY_DIR_NATIVE)
string(REPLACE "\\" "\\\\" PROJECT_SOURCE_DIR_NATIVE_D ${PROJECT_SOURCE_DIR_NATIVE})
string(REPLACE "\\" "\\\\" PROJECT_BINARY_DIR_NATIVE_D ${PROJECT_BINARY_DIR_NATIVE})

configure_file(${CMAKE_SOURCE_DIR}/cmake/CPackOptions.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CPackOptions.cmake @ONLY)
set (CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/CPackOptions.cmake")
#set (CPACK_GENERATOR TGZ) # not use ZIP on UNIX as problem with symlinks
#set (CPACK_SOURCE_GENERATOR TGZ) # not use ZIP on UNIX as problem with symlinks
if (UNIX)
  set (CPACK_GENERATOR ${CPACK_GENERATOR};RPM)
endif ()
# Include of CPack must always be last
include(CPack)

#--- end ----------------------------------------------------------------------

Thank you again for any additional help you can offer.

Try posting instead the file src/CMakelists.txt

Here’s the src/CMakeLists.txt file

add_subdirectory(classes)
add_subdirectory(external)
if (Qt6Core_FOUND)
  add_subdirectory(musredit_qt6)
elseif (Qt5Core_FOUND)
  add_subdirectory(musredit_qt5)
elseif (Qt4_FOUND)
  add_subdirectory(musredit)
elseif (QT_FOUND)
  add_subdirectory(musrgui)
endif ()

#--- define the musrfit libs --------------------------------------------------
set(MUSRFIT_LIBS ${MUSRFIT_LIBS} mud)
set(MUSRFIT_LIBS ${MUSRFIT_LIBS} TMusrRunHeader)
set(MUSRFIT_LIBS ${MUSRFIT_LIBS} TLemRunHeader)
set(MUSRFIT_LIBS ${MUSRFIT_LIBS} Class_MuSR_PSI)
if (nexus)
  set(MUSRFIT_LIBS ${MUSRFIT_LIBS} ${NEXUS_LIBRARY})
  set(MUSRFIT_LIBS ${MUSRFIT_LIBS} PNeXus)
endif (nexus)
set(MUSRFIT_LIBS ${MUSRFIT_LIBS} PMusr)

#--- start create git-revision.h ----------------------------------------------
if (IS_GIT_REPO)
  configure_file(
    ${CMAKE_SOURCE_DIR}/cmake/configure_musrfit_version_file.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/configure_musrfit_version_file.cmake
    @ONLY
  )

  add_custom_command(
    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/git-revision.h
    COMMAND ${CMAKE_COMMAND} -P
      ${CMAKE_CURRENT_BINARY_DIR}/configure_musrfit_version_file.cmake
    DEPENDS
      ${CMAKE_CURRENT_BINARY_DIR}/configure_musrfit_version_file.cmake
      ${CMAKE_SOURCE_DIR}/cmake/git-revision.h.in
    COMMENT "Configuring git-revision.h"
    VERBATIM
  )

  add_custom_target(
    configure_musrfit_version ALL
    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/git-revision.h
  )
  set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")  
  set(GIT_REV_H "git-revision.h")
else (IS_GIT_REPO)
  set(HAVE_GIT_REV_H "")  
  set(GIT_REV_H "")
endif (IS_GIT_REPO)

#--- end create git-revision.h ------------------------------------------------

#--- add all executables ------------------------------------------------------
add_executable(addRun ${GIT_REV_H} addRun.cpp)
target_compile_options(addRun BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(addRun 
  BEFORE PRIVATE
    $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
)
target_link_libraries(addRun ${ROOT_LIBRARIES} ${MUSRFIT_LIBS} ${Boost_LIBRARIES})

add_executable(any2many ${GIT_REV_H} any2many.cpp)
target_compile_options(any2many BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(any2many 
  BEFORE PRIVATE
    $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
)
target_link_libraries(any2many ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})

add_executable(dump_header ${GIT_REV_H} dump_header.cpp)
target_compile_options(dump_header BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(dump_header 
  BEFORE PRIVATE 
    $<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
    $<BUILD_INTERFACE:${NEXUS_INCLUDE_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/external/MusrRoot>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/external/TLemRunHeader>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/external/MuSR_software/Class_MuSR_PSI/>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/external/mud/src>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/external/nexus>
)
target_link_libraries(dump_header ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})

add_executable(msr2data ${GIT_REV_H} msr2data.cpp)
target_compile_options(msr2data BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(msr2data 
  BEFORE PRIVATE 
    $<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
)
target_link_libraries(msr2data ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})

add_executable(msr2msr msr2msr.cpp)
target_link_libraries(msr2msr ${ROOT_LIBRARIES})

add_executable(musrfit ${GIT_REV_H} musrfit.cpp)
target_compile_options(musrfit BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(musrfit 
  BEFORE PRIVATE 
    $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
)
target_link_libraries(musrfit ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})

add_executable(musrFT ${GIT_REV_H} musrFT.cpp)
target_compile_options(musrFT BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(musrFT 
  BEFORE PRIVATE 
    $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
    $<BUILD_INTERFACE:${FFTW3_INCLUDE}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
)
target_link_libraries(musrFT  FFTW3::FFTW3 ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})

add_executable(musrRootValidation ${GIT_REV_H} musrRootValidation.cpp)
target_compile_options(musrRootValidation BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(musrRootValidation 
  BEFORE PRIVATE
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
    $<BUILD_INTERFACE:${LIBXML2_INCLUDE_DIR}>
)
target_link_libraries(musrRootValidation ${ROOT_LIBRARIES} ${MUSRFIT_LIBS} ${LIBXML2_LIBRARIES})

add_executable(musrt0 ${GIT_REV_H} musrt0.cpp)
target_compile_options(musrt0 BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(musrt0 
  BEFORE PRIVATE 
    $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
)
target_link_libraries(musrt0 ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})

add_executable(musrview ${GIT_REV_H} musrview.cpp)
target_compile_options(musrview BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(musrview 
  BEFORE PRIVATE
    $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
    $<BUILD_INTERFACE:${FFTW3_INCLUDE}> 
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
)
target_link_libraries(musrview FFTW3::FFTW3 ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})

add_executable(write_musrRoot_runHeader ${GIT_REV_H} write_musrRoot_runHeader.cpp)
target_compile_options(write_musrRoot_runHeader BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(write_musrRoot_runHeader 
  BEFORE PRIVATE
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
    $<BUILD_INTERFACE:${LIBXML2_INCLUDE_DIR}>
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/external/MusrRoot>
)
target_link_libraries(write_musrRoot_runHeader ${ROOT_LIBRARIES} ${MUSRFIT_LIBS} ${LIBXML2_LIBRARIES})

#--- installation info --------------------------------------------------------
install(
  TARGETS
    addRun
    any2many
    dump_header
    msr2data
    msr2msr
    musrfit
    musrFT
    musrRootValidation
    musrt0
    musrview
    write_musrRoot_runHeader
  RUNTIME DESTINATION 
    bin
)

I imagine the code you mentioned should be written somewhere into the “add all executables” block.
It seems to have several targets to install and I’m not sure which I would include as the program name here. I’d guess the default of musrfit, but maybe you can make a more educated guess than I on this.

Thank you again for your continued help on this.

Try searching recursively on your folders the target msr2msr

It’s in this one where you need to add the extra link to ROOT::XMLParser

So:

target_link_libraries(msr2msr ${ROOT_LIBRARIES} ROOT::XMLParser)

A dirty hack could also be

target_include_directories(msr2msr pathToWhereHeaderFileIs)