Skip to content

Commit a1cd5e6

Browse files
[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 <[email protected]>
1 parent 053750c commit a1cd5e6

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

flang/docs/ModFiles.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ often use `rm *.mod` to clean up.
2727
The disadvantage of using the same name as other compilers is that it is not
2828
clear which compiler created a `.mod` file and files from multiple compilers
2929
cannot be in the same directory. This could be solved by adding something
30-
between the module name and extension, e.g. `<modulename>-f18.mod`.
30+
between the module name and extension, e.g. `<modulename>-f18.mod`. If this
31+
is needed, Flang's fc1 accepts the option `-module-suffix` to alter the suffix
32+
used for the module file.
3133

3234
## Format
3335

flang/tools/f18/CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,8 @@ if (NOT CMAKE_CROSSCOMPILING)
6262
${FLANG_SOURCE_DIR}/module/${filename}.f90
6363
DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${FLANG_SOURCE_DIR}/module/__fortran_builtins.f90 ${depends}
6464
)
65-
add_custom_command(OUTPUT ${base}.f18.mod
66-
DEPENDS ${base}.mod
67-
COMMAND ${CMAKE_COMMAND} -E copy ${base}.mod ${base}.f18.mod)
68-
list(APPEND MODULE_FILES ${base}.mod ${base}.f18.mod)
69-
install(FILES ${base}.mod ${base}.f18.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
65+
list(APPEND MODULE_FILES ${base}.mod)
66+
install(FILES ${base}.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
7067
endforeach()
7168

7269
# Special case for omp_lib.mod, because its source comes from openmp/runtime/src/include.

0 commit comments

Comments
 (0)