diff --git a/cmake/modules/RootMacros.cmake b/cmake/modules/RootMacros.cmake index 0e0d9c8941d69..1824c07d18f63 100644 --- a/cmake/modules/RootMacros.cmake +++ b/cmake/modules/RootMacros.cmake @@ -918,14 +918,10 @@ function(ROOT_LINKER_LIBRARY library) if(ARG_TEST) # we are building a test, so add EXCLUDE_FROM_ALL set(_all EXCLUDE_FROM_ALL) endif() - set(library_name ${library}) if(TARGET ${library}) message(FATAL_ERROR "Target ${library} already exists.") endif() if(WIN32 AND ARG_TYPE STREQUAL SHARED AND NOT ARG_DLLEXPORT) - if(MSVC) - set(library_name ${libprefix}${library}) - endif() #---create a shared library with the .def file------------------------ add_library(${library} ${_all} SHARED ${lib_srcs}) set_target_properties(${library} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) @@ -958,7 +954,10 @@ function(ROOT_LINKER_LIBRARY library) endif() endif() - set_target_properties(${library} PROPERTIES OUTPUT_NAME ${library_name}) + set_target_properties(${library} PROPERTIES + PREFIX ${libprefix} + IMPORT_PREFIX ${libprefix} # affects the .lib import library (MSVC) + ) target_include_directories(${library} INTERFACE $) # Do not add -Dname_EXPORTS to the command-line when building files in this # target. Doing so is actively harmful for the modules build because it