From 8ced8775bf536c9fc2ef28e81d6b525cb6178056 Mon Sep 17 00:00:00 2001 From: Allison Piper Date: Wed, 18 Sep 2024 11:24:58 -0400 Subject: [PATCH] Fix thrust package to work with newer FindOpenMP.cmake. (#2421) The FindOpenMP module shipped with CMake started (unnecessarily...) including the SHELL: prefix on it's -fopenmp flag. --- thrust/thrust/cmake/thrust-config.cmake | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/thrust/thrust/cmake/thrust-config.cmake b/thrust/thrust/cmake/thrust-config.cmake index 7b3d5dfd31..e94c049529 100644 --- a/thrust/thrust/cmake/thrust-config.cmake +++ b/thrust/thrust/cmake/thrust-config.cmake @@ -618,11 +618,17 @@ endmacro() # Wrap the OpenMP flags for CUDA targets function(thrust_fixup_omp_target omp_target) get_target_property(opts ${omp_target} INTERFACE_COMPILE_OPTIONS) - if (opts MATCHES "\\$<\\$:([^>]*)>") - target_compile_options(${omp_target} INTERFACE - $<$:-Xcompiler=${CMAKE_MATCH_1}> - ) - endif() + foreach (opt IN LISTS opts) + if (opts MATCHES "\\$<\\$:SHELL:([^>]*)>") + target_compile_options(${omp_target} INTERFACE + $<$:SHELL:-Xcompiler=${CMAKE_MATCH_1}> + ) + elseif (opts MATCHES "\\$<\\$:([^>]*)>") + target_compile_options(${omp_target} INTERFACE + $<$:-Xcompiler=${CMAKE_MATCH_1}> + ) + endif() + endforeach() endfunction() # This must be a macro instead of a function to ensure that backends passed to