@@ -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 ()
@@ -918,14 +919,10 @@ function(ROOT_LINKER_LIBRARY library)
918919 if (ARG_TEST) # we are building a test, so add EXCLUDE_FROM_ALL
919920 set (_all EXCLUDE_FROM_ALL )
920921 endif ()
921- set (library_name ${library} )
922922 if (TARGET ${library} )
923923 message (FATAL_ERROR "Target ${library} already exists." )
924924 endif ()
925925 if (WIN32 AND ARG_TYPE STREQUAL SHARED AND NOT ARG_DLLEXPORT)
926- if (MSVC )
927- set (library_name ${libprefix}${library} )
928- endif ()
929926 #---create a shared library with the .def file------------------------
930927 add_library (${library} ${_all} SHARED ${lib_srcs} )
931928 set_target_properties (${library} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE )
@@ -958,7 +955,7 @@ function(ROOT_LINKER_LIBRARY library)
958955 endif ()
959956 endif ()
960957
961- set_target_properties (${library} PROPERTIES OUTPUT_NAME ${library_name } )
958+ set_target_properties (${library} PROPERTIES OUTPUT_NAME ${library } )
962959 target_include_directories (${library} INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >)
963960 # Do not add -Dname_EXPORTS to the command-line when building files in this
964961 # target. Doing so is actively harmful for the modules build because it
0 commit comments