root icon indicating copy to clipboard operation
root copied to clipboard

root_generate_dictionary should check target OUTPUT_NAME

Open lmoureaux opened this issue 1 year ago • 0 comments

Check duplicate issues.

  • [X] Checked for duplicates

Description

When a dictionary is generated for a library target called foo, whose OUTPUT_NAME is set to bar, root_generate_dictionary produces dictionary files called libfoo_rdict.pcm and libfoo.rootmap.

Reproducer

ROOTBug.cc and LinkDef.h are both empty files. Contents of CMakeLists.txt:

cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
project(ROOTBug)
find_package(ROOT 6.28 REQUIRED)

# https://github.com/root-project/root/issues/8308#issuecomment-1143791946
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

# another bug... INSTALL FILES given no destination!
include(GNUInstallDirs)

add_library(ROOTBug SHARED ROOTBug.cc)
target_link_libraries(ROOTBug PRIVATE ROOT::Core)
set_target_properties(ROOTBug PROPERTIES OUTPUT_NAME ROOTWorks)  # Important!
root_generate_dictionary(ROOTWorksDict MODULE ROOTBug LINKDEF LinkDef.h)

install(TARGETS ROOTBug)

Build commands:

$ cmake -B build -DCMAKE_INSTALL_PREFIX=install
$ cmake --build build --target install
[ 25%] Generating ROOTBugDict.cxx, libROOTBug_rdict.pcm, libROOTBug.rootmap
[ 50%] Building CXX object CMakeFiles/ROOTBugDict.dir/ROOTBugDict.cxx.o
[ 50%] Built target ROOTBugDict
[ 75%] Linking CXX shared library libROOTWorks.so
[100%] Built target ROOTBug
Install the project...
-- Install configuration: ""
-- Installing: /nfs/dust/cms/user/mourelou/darwin/tests/install/lib64/libROOTBug_rdict.pcm
-- Installing: /nfs/dust/cms/user/mourelou/darwin/tests/install/lib64/libROOTBug.rootmap
-- Installing: /nfs/dust/cms/user/mourelou/darwin/tests/install/lib64/libROOTWorks.so
-- Set runtime path of "/nfs/dust/cms/user/mourelou/darwin/tests/install/lib64/libROOTWorks.so" to ""

Then do:

$ ls install/lib*
libROOTBug_rdict.pcm  libROOTBug.rootmap  libROOTWorks.so

Notice how the library name is different from the dictionary name.

ROOT version

LCG 104

   ------------------------------------------------------------------
  | Welcome to ROOT 6.28/04                        https://root.cern |
  | (c) 1995-2022, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on May 08 2023, 02:44:07                 |
  | From tags/v6-28-04@v6-28-04                                      |
  | With g++ (GCC) 12.1.0                                            |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------

Installation method

LCG 104

Operating system

CentOS 7

Additional context

No response

lmoureaux avatar Jun 07 '24 14:06 lmoureaux