@@ -421,36 +421,14 @@ get_property(__allBuiltins GLOBAL PROPERTY ROOT_BUILTIN_TARGETS)
421421add_custom_target (move_headers ALL DEPENDS ${__allHeaders} ${__allBuiltins} gitinfotxt)
422422
423423#---CXX MODULES-----------------------------------------------------------------------------------
424- if (MSVC )
425- set (_os_cat "type" )
426- else ()
427- set (_os_cat "cat" )
428- endif ()
429- cmake_path(CONVERT "${CMAKE_BINARY_DIR} /include/module.modulemap.extra" TO_NATIVE_PATH_LIST _from_native)
430- cmake_path(CONVERT "${CMAKE_BINARY_DIR} /include/ROOT.modulemap" TO_NATIVE_PATH_LIST _to_native)
431-
432- add_custom_target (copymodulemap DEPENDS "${CMAKE_BINARY_DIR} /include/ROOT.modulemap" )
433- add_custom_command (
434- OUTPUT "${CMAKE_BINARY_DIR} /include/ROOT.modulemap"
435- DEPENDS cmake/unix /module.modulemap "${CMAKE_BINARY_DIR} /include/module.modulemap.extra"
436- COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR} /cmake/unix/module.modulemap" "${CMAKE_BINARY_DIR} /include/ROOT.modulemap"
437- COMMAND ${_os_cat} "${_from_native} " >> "${_to_native} "
438- )
439- install (FILES "${CMAKE_BINARY_DIR} /include/ROOT.modulemap" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT headers)
440-
441- add_dependencies (move_headers copymodulemap)
442-
443424# Take all the modulemap contents we collected from the packages and append them to our modulemap.
444425# We have to delay this because the ROOT_CXXMODULES_EXTRA_MODULEMAP_CONTENT is filled in the
445426# add_subdirectory calls above.
446427get_property (__modulemap_extra_content GLOBAL PROPERTY ROOT_CXXMODULES_EXTRA_MODULEMAP_CONTENT)
447- string (REPLACE ";" "" __modulemap_extra_content "${__modulemap_extra_content} " )
448- # Write module.modulemap.extra to a temporary file first, to not touch module.modulemap.extra
449- # if it's unchanged.
450- file (WRITE "${CMAKE_BINARY_DIR} /include/module.modulemap.extra.tmp" "${__modulemap_extra_content} " )
451- configure_file ("${CMAKE_BINARY_DIR} /include/module.modulemap.extra.tmp"
452- "${CMAKE_BINARY_DIR} /include/module.modulemap.extra"
453- COPYONLY )
428+ string (REPLACE ";" "" ROOT_GENERATED_MODULEMAP_CONTENT "${__modulemap_extra_content} " )
429+ # Now append the generated content to the original modulemap
430+ configure_file (${CMAKE_SOURCE_DIR} /cmake/unix /module.modulemap ${CMAKE_BINARY_DIR} /include /ROOT.modulemap)
431+ install (FILES "${CMAKE_BINARY_DIR} /include/ROOT.modulemap" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT headers)
454432
455433# From now on we handled all exposed module and want to make all new modulemaps private to ROOT.
456434set (ROOT_CXXMODULES_WRITE_TO_CURRENT_DIR ON )
0 commit comments