[flang] Do not create .f18.mod files for each compiled module (#85249)

The default CMake scripts had a copy operation to copy a compiled `.mod`
file to also be available with suffix `.f18.mod`. This seems no longer
needed. Also updated ModFiles.md to point to `-module-suffix`.

---------

Co-authored-by: Kiran Chandramohan <kiranchandramohan@gmail.com>
This commit is contained in:
Michael Klemm 2024-04-11 10:18:34 +02:00 committed by GitHub
parent 053750c3b4
commit a1cd5e6954
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

View File

@ -27,7 +27,9 @@ often use `rm *.mod` to clean up.
The disadvantage of using the same name as other compilers is that it is not
clear which compiler created a `.mod` file and files from multiple compilers
cannot be in the same directory. This could be solved by adding something
between the module name and extension, e.g. `<modulename>-f18.mod`.
between the module name and extension, e.g. `<modulename>-f18.mod`. If this
is needed, Flang's fc1 accepts the option `-module-suffix` to alter the suffix
used for the module file.
## Format

View File

@ -62,11 +62,8 @@ if (NOT CMAKE_CROSSCOMPILING)
${FLANG_SOURCE_DIR}/module/${filename}.f90
DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${FLANG_SOURCE_DIR}/module/__fortran_builtins.f90 ${depends}
)
add_custom_command(OUTPUT ${base}.f18.mod
DEPENDS ${base}.mod
COMMAND ${CMAKE_COMMAND} -E copy ${base}.mod ${base}.f18.mod)
list(APPEND MODULE_FILES ${base}.mod ${base}.f18.mod)
install(FILES ${base}.mod ${base}.f18.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
list(APPEND MODULE_FILES ${base}.mod)
install(FILES ${base}.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
endforeach()
# Special case for omp_lib.mod, because its source comes from openmp/runtime/src/include.