diff --git a/config/unix-cuda.cmake b/config/unix-cuda.cmake index be9570107..6bd1e59a4 100644 --- a/config/unix-cuda.cmake +++ b/config/unix-cuda.cmake @@ -65,7 +65,7 @@ if(NOT CUDA_FLAGS_INITIALIZED) file(READ /etc/redhat-release rhr) string(REGEX REPLACE "[^0-9]*([0-9]+).([0-9]+).*" "\\1.\\2" redhat_version "${rhr}") # If manually specified (eg. spack), do not add the --gcc-toolchain option - if(NOT (CMAKE_CUDA_FLAGS MATCHES "--gcc-toolchain=" OR $ENV{SPACK_CFLAGS} MATCHES + if(NOT (CMAKE_CUDA_FLAGS MATCHES "--gcc-toolchain=" OR "$ENV{SPACK_CFLAGS}" MATCHES "--gcc-toolchain=")) string(APPEND CMAKE_CUDA_FLAGS " -Xcompiler") if(redhat_version MATCHES "^8.([0-9]+)") diff --git a/config/unix-xl.cmake b/config/unix-xl.cmake index e2c58680c..c9c39fac5 100644 --- a/config/unix-xl.cmake +++ b/config/unix-xl.cmake @@ -33,7 +33,7 @@ if(NOT CXX_FLAGS_INITIALIZED) file(READ /etc/redhat-release rhr) string(REGEX REPLACE "[^0-9]*([0-9]+).([0-9]+).*" "\\1.\\2" redhat_version "${rhr}") # If manually specified (eg. spack), do not add the --gcc-toolchain option - if(NOT (CMAKE_C_FLAGS MATCHES "--gcc-toolchain=" OR $ENV{SPACK_CFLAGS} MATCHES + if(NOT (CMAKE_C_FLAGS MATCHES "--gcc-toolchain=" OR "$ENV{SPACK_CFLAGS}" MATCHES "--gcc-toolchain=")) if(redhat_version MATCHES "^8.([0-9]+)") string(APPEND CMAKE_C_FLAGS " --gcc-toolchain=/usr/tce/packages/gcc/gcc-11.2.1")