Skip to content

Capture module file dependencies in CMake #1148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions SRC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
#
#######################################################################

set(ALLMOD la_xisnan.F90 la_constants.f90)
set(CONSTMOD la_constants.f90)

set(NANMOD la_xisnan.F90)

set(ALLAUX ilaenv.f ilaenv2stage.f ieeeck.f lsamen.f iparmq.f iparam2stage.F
ilaprec.f ilatrans.f ilauplo.f iladiag.f chla_transtype.f
Expand Down Expand Up @@ -519,7 +521,14 @@ list(REMOVE_DUPLICATES SOURCES)

# Use special target for MOD files to guarantee they are built before
# any other files that depend on them
add_library(mod_files OBJECT ${ALLMOD})
add_library(const_mod_file OBJECT ${CONSTMOD})
set_target_properties(
const_mod_file PROPERTIES
POSITION_INDEPENDENT_CODE ON
Fortran_PREPROCESS ON
)

add_library(mod_files OBJECT ${NANMOD} $<TARGET_OBJECTS:const_mod_file>)
set_target_properties(
mod_files PROPERTIES
POSITION_INDEPENDENT_CODE ON
Expand Down
Loading