File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -261,7 +261,6 @@ if (NOT DEFINED MSVC)
261
261
262
262
INSTALL_WITH_TOOLCHAIN
263
263
)
264
- target_link_libraries (FortranRuntime PRIVATE ${FORTRAN_MODULE_OBJECTS} )
265
264
else ()
266
265
add_flang_library (FortranRuntime
267
266
${sources}
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ set(MODULES ${MODULES_WITH_IMPLEMENTATION} ${MODULES_WITHOUT_IMPLEMENTATION})
33
33
34
34
# Init variable to hold extra object files coming from the Fortran modules;
35
35
# these module files will be contributed from the CMakeLists in flang/tools/f18.
36
- unset ( FORTRAN_MODULE_OBJECTS CACHE )
36
+ set ( module_objects "" )
37
37
38
38
# Create module files directly from the top-level module source directory.
39
39
# If CMAKE_CROSSCOMPILING, then the newly built flang-new executable was
@@ -102,10 +102,15 @@ if (NOT CMAKE_CROSSCOMPILING)
102
102
# If a module has been compiled into an object file, add the file to
103
103
# the link line for the FortranRuntime library.
104
104
if (include_in_link )
105
- set (FORTRAN_MODULE_OBJECTS " ${FORTRAN_MODULE_OBJECTS} " " ${object_output} " CACHE INTERNAL "" )
105
+ set (module_objects ${module_} ${object_output} )
106
106
endif ()
107
107
endforeach ()
108
108
109
+ # Set a CACHE variable that is visible to the CMakeLists.txt in runtime/, so that
110
+ # the compiled Fortran modules can be added to the link line of the FortranRuntime
111
+ # library.
112
+ set (FORTRAN_MODULE_OBJECTS ${module_objects} CACHE INTERNAL "" )
113
+
109
114
# Special case for omp_lib.mod, because its source comes from openmp/runtime/src/include.
110
115
# It also produces two module files: omp_lib.mod and omp_lib_kinds.mod. Compile these
111
116
# files only if OpenMP support has been configured.
You can’t perform that action at this time.
0 commit comments