From 522d7d4e0711eaae613a01ea5c58d07709ebd34d Mon Sep 17 00:00:00 2001 From: Kelly Glen Thompson Date: Thu, 24 Aug 2023 10:31:49 -0600 Subject: [PATCH] Fix compiler flag logic for XL gcc-toolchain used with spack. --- config/unix-cuda.cmake | 2 +- config/unix-xl.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/unix-cuda.cmake b/config/unix-cuda.cmake index b07de4881..be9570107 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 2acf82ea5..e2c58680c 100644 --- a/config/unix-xl.cmake +++ b/config/unix-xl.cmake @@ -33,8 +33,8 @@ 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 "--gcc-toolchain=" - )) + 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") else()