From 56ff12501f908220953d7d80408732144ffa17d6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 1 Jun 2023 15:18:33 -0400 Subject: FindOpenMP: Keep flags together in imported target usage requirements If `OpenMP_C_FLAGS` contains `-Xclang -fopenmp`, the flag pair needs to be preserved as a shell command fragment, and must not be split by de-duplication with other `target_compile_options`. Fixes: #24966 --- Modules/FindOpenMP.cmake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 68be2d6..cd912c3 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -600,15 +600,13 @@ foreach(LANG IN LISTS OpenMP_FINDLIST) add_library(OpenMP::OpenMP_${LANG} INTERFACE IMPORTED) endif() if(OpenMP_${LANG}_FLAGS) - separate_arguments(_OpenMP_${LANG}_OPTIONS NATIVE_COMMAND "${OpenMP_${LANG}_FLAGS}") set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY - INTERFACE_COMPILE_OPTIONS "$<$:${_OpenMP_${LANG}_OPTIONS}>") + INTERFACE_COMPILE_OPTIONS "$<$:SHELL:${OpenMP_${LANG}_FLAGS}>") if(CMAKE_${LANG}_COMPILER_ID STREQUAL "Fujitsu" OR ${CMAKE_${LANG}_COMPILER_ID} STREQUAL "IntelLLVM") set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY - INTERFACE_LINK_OPTIONS "${OpenMP_${LANG}_FLAGS}") + INTERFACE_LINK_OPTIONS "SHELL:${OpenMP_${LANG}_FLAGS}") endif() - unset(_OpenMP_${LANG}_OPTIONS) endif() if(OpenMP_${LANG}_INCLUDE_DIRS) set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY -- cgit v0.12