Skip to content

Commit

Permalink
Set the CACHE variable only once
Browse files Browse the repository at this point in the history
  • Loading branch information
mjklemm committed Jul 15, 2024
1 parent 3a80ca5 commit 01179b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion flang/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ if (NOT DEFINED MSVC)

INSTALL_WITH_TOOLCHAIN
)
target_link_libraries(FortranRuntime PRIVATE ${FORTRAN_MODULE_OBJECTS})
else()
add_flang_library(FortranRuntime
${sources}
Expand Down
9 changes: 7 additions & 2 deletions flang/tools/f18/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ set(MODULES ${MODULES_WITH_IMPLEMENTATION} ${MODULES_WITHOUT_IMPLEMENTATION})

# Init variable to hold extra object files coming from the Fortran modules;
# these module files will be contributed from the CMakeLists in flang/tools/f18.
unset(FORTRAN_MODULE_OBJECTS CACHE)
set(module_objects "")

# Create module files directly from the top-level module source directory.
# If CMAKE_CROSSCOMPILING, then the newly built flang-new executable was
Expand Down Expand Up @@ -102,10 +102,15 @@ if (NOT CMAKE_CROSSCOMPILING)
# If a module has been compiled into an object file, add the file to
# the link line for the FortranRuntime library.
if(include_in_link)
set(FORTRAN_MODULE_OBJECTS "${FORTRAN_MODULE_OBJECTS}" "${object_output}" CACHE INTERNAL "")
set(module_objects ${module_} ${object_output})
endif()
endforeach()

# Set a CACHE variable that is visible to the CMakeLists.txt in runtime/, so that
# the compiled Fortran modules can be added to the link line of the FortranRuntime
# library.
set(FORTRAN_MODULE_OBJECTS ${module_objects} CACHE INTERNAL "")

# Special case for omp_lib.mod, because its source comes from openmp/runtime/src/include.
# It also produces two module files: omp_lib.mod and omp_lib_kinds.mod. Compile these
# files only if OpenMP support has been configured.
Expand Down

0 comments on commit 01179b1

Please sign in to comment.