Skip to content

Commit c5af966

Browse files
committed
[CMake] Use output name of MODULE target also for dictionary name
Use output name of `MODULE` target also for the dictionary name, if the target is defined. This makes the dictionary and library file names more consistent. Closes #15792.
1 parent 94f2afc commit c5af966

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

cmake/modules/RootMacros.cmake

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -515,22 +515,23 @@ function(ROOT_GENERATE_DICTIONARY dictionary)
515515
endforeach()
516516

517517
#---Build the names for library, pcm and rootmap file ----
518-
set(library_target_name)
519-
if(dictionary MATCHES "^G__")
518+
if(TARGET ${ARG_MODULE})
519+
get_target_property(library_target_name ${ARG_MODULE} OUTPUT_NAME)
520+
elseif(dictionary MATCHES "^G__")
520521
string(REGEX REPLACE "^G__(.*)" "\\1" library_target_name ${dictionary})
521522
if (ARG_MULTIDICT)
522523
string(REGEX REPLACE "(.*)32$" "\\1" library_target_name ${library_target_name})
523524
endif (ARG_MULTIDICT)
524525
else()
525526
get_filename_component(library_target_name ${dictionary} NAME_WE)
526527
endif()
527-
if (ARG_MODULE)
528+
if (ARG_MODULE AND NOT TARGET ${ARG_MODULE})
528529
if (NOT ${ARG_MODULE} STREQUAL ${library_target_name})
529530
# message(AUTHOR_WARNING "The MODULE argument ${ARG_MODULE} and the deduced library name "
530531
# "${library_target_name} mismatch. Deduction stem: ${dictionary}.")
531532
set(library_target_name ${ARG_MODULE})
532533
endif()
533-
endif(ARG_MODULE)
534+
endif()
534535

535536
#---Set the library output directory-----------------------
536537
ROOT_GET_LIBRARY_OUTPUT_DIR(library_output_dir)
@@ -558,7 +559,7 @@ function(ROOT_GENERATE_DICTIONARY dictionary)
558559
set(cpp_module_file ${library_output_dir}/${cpp_module}.pcm)
559560
# The module depends on its modulemap file.
560561
if (cpp_module_file AND CMAKE_PROJECT_NAME STREQUAL ROOT)
561-
set (runtime_cxxmodule_dependencies copymodulemap "${CMAKE_BINARY_DIR}/include/ROOT.modulemap")
562+
set (runtime_cxxmodule_dependencies copymodulemap "${CMAKE_BINARY_DIR}/include/ROOT.modulemap")
562563
endif()
563564
endif(cpp_module)
564565
endif()

0 commit comments

Comments
 (0)