diff --git a/templates/build_icon.sh b/templates/build_icon.sh
index 7e78413c3680e2ad78e7e954db0d1403d606a535..b5ef0337e13420977b9cc3bf2db2d28d94119a07 100644
--- a/templates/build_icon.sh
+++ b/templates/build_icon.sh
@@ -29,7 +29,7 @@ source ${SPACK_ENV}
 if [ $( spack find icon-nwp@${ICON_VERSION} &> /dev/null ; echo $? ) -ne 0 ]; then
         echo "Installing icon-nwp@${ICON_VERSION}."
         # Compile openmpi with schedulers=slurm
-        spack install openmpi${SPACK_COMPILER}+legacylaunchers schedulers=slurm
+        spack install openmpi%${SPACK_COMPILER}+legacylaunchers schedulers=slurm
         spack install icon-nwp@${ICON_VERSION}%${SPACK_COMPILER} ^openmpi%${SPACK_COMPILER}
 else
         echo "icon-nwp@${ICON_VERSION} already installed!"