Skip to content

Commit 348b2a1

Browse files
Danielelmuellender
Daniele
authored andcommitted
Activating plumed do not need an extra cached variable anymore
As we discussed in #5292, I modified how `gmx_manage_plumed` activates the plumed module and moved where it is called.
1 parent 68be388 commit 348b2a1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

cmake/gmxManagePlumed.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mark_as_advanced(GMX_USE_PLUMED)
4848
function(gmx_manage_plumed)
4949
# Create a link target, leave it empty if the plumed option is not active
5050
add_library(plumedgmx INTERFACE)
51-
set (GMX_PLUMED_ACTIVE OFF CACHE INTERNAL "Cache entry for PLUMED activation")
51+
set (GMX_PLUMED_ACTIVE OFF PARENT_SCOPE)
5252
if(WIN32)
5353
if(GMX_USE_PLUMED STREQUAL "ON")
5454
message(FATAL_ERROR "PLUMED is not supported on Windows. Reconfigure with -DGMX_USE_PLUMED=OFF.")
@@ -67,7 +67,7 @@ function(gmx_manage_plumed)
6767
target_link_libraries( plumedgmx INTERFACE ${CMAKE_DL_LIBS} )
6868
# The plumedgmx already exists, now we set it up:
6969
target_include_directories(plumedgmx SYSTEM INTERFACE $<BUILD_INTERFACE:${PLUMED_DIR}>)
70-
set (GMX_PLUMED_ACTIVE ON CACHE INTERNAL "Cache entry for PLUMED activation")
70+
set (GMX_PLUMED_ACTIVE ON PARENT_SCOPE)
7171
else()
7272
if(GMX_USE_PLUMED STREQUAL "ON")
7373
message(FATAL_ERROR "PLUMED needs dlopen or anything equivalent. Reconfigure with -DGMX_USE_PLUMED=OFF.")

src/gromacs/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ mark_as_advanced(GMX_USE_SIMD_KERNELS)
6868
# pulling is using the muparser target as well, so detect it early
6969
gmx_manage_muparser()
7070

71+
# The following functions and macros called here sets up the "module_x_active" variable before
72+
# including the directories with their own modules
73+
gmx_manage_plumed()
74+
7175
# Add these contents first because linking their tests can take a lot
7276
# of time, so we want lots of parallel work still available after
7377
# linking starts.
@@ -450,7 +454,6 @@ target_link_libraries(libgromacs PRIVATE lmfit)
450454
target_link_libraries(libgromacs PRIVATE muparser::muparser)
451455
gmx_manage_colvars()
452456
target_link_libraries(libgromacs PRIVATE colvars)
453-
gmx_manage_plumed()
454457
target_link_libraries(libgromacs PRIVATE plumedgmx)
455458

456459
# Make sure we fix "everything" found by compilers that support that

0 commit comments

Comments
 (0)