From fee4e26bdd51823a786e8bc18be5e5462da3f20f Mon Sep 17 00:00:00 2001 From: "M. Eric Irrgang" Date: Thu, 14 Aug 2025 16:53:27 -0700 Subject: [PATCH 1/2] Process compile flag lists like link_flags Add logic to `blt_add_target_compile_flags()` to prepend `SHELL:` to possible argument lists in the way that `blt_add_target_link_flags()`. Fixes #723 --- cmake/BLTInstallableMacros.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index 815da45d5..567cc20c9 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -412,6 +412,13 @@ macro(blt_add_target_compile_flags) # Only add the flag if it is not empty string(STRIP "${arg_FLAGS}" _strippedFlags) if(NOT "${_strippedFlags}" STREQUAL "") + # COMPILE_OPTIONS and INTERFACE_COMPILE_OPTIONS are semicolon-delimited lists, + # but the string in arg_FLAGS may be a space-delimited string of command line options. + # Note: "SHELL:"" causes the flags to be not de-duplicated and parsed with + # separate_arguments + if(NOT "${_strippedFlags}" MATCHES SHELL:) + set(_strippedFlags "SHELL:${_strippedFlags}") + endif() get_target_property(_target_type ${arg_TO} TYPE) if (("${_target_type}" STREQUAL "INTERFACE_LIBRARY") AND (${CMAKE_VERSION} VERSION_LESS "3.11.0")) set_property(TARGET ${arg_NAME} APPEND PROPERTY From 1931b2e671ab51555a0346f6b76710f2fd98218f Mon Sep 17 00:00:00 2001 From: Eric Vardar-Irrgang Date: Thu, 30 Apr 2026 16:53:35 -0700 Subject: [PATCH 2/2] Use a less invasive fix. --- cmake/BLTInstallableMacros.cmake | 7 ------- cmake/thirdparty/BLTSetupOpenMP.cmake | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index bbd6d703b..7ffb21e44 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -412,13 +412,6 @@ macro(blt_add_target_compile_flags) # Only add the flag if it is not empty string(STRIP "${arg_FLAGS}" _strippedFlags) if(NOT "${_strippedFlags}" STREQUAL "") - # COMPILE_OPTIONS and INTERFACE_COMPILE_OPTIONS are semicolon-delimited lists, - # but the string in arg_FLAGS may be a space-delimited string of command line options. - # Note: "SHELL:"" causes the flags to be not de-duplicated and parsed with - # separate_arguments - if(NOT "${_strippedFlags}" MATCHES SHELL:) - set(_strippedFlags "SHELL:${_strippedFlags}") - endif() get_target_property(_target_type ${arg_TO} TYPE) if (("${_target_type}" STREQUAL "INTERFACE_LIBRARY") AND (${CMAKE_VERSION} VERSION_LESS "3.11.0")) set_property(TARGET ${arg_NAME} APPEND PROPERTY diff --git a/cmake/thirdparty/BLTSetupOpenMP.cmake b/cmake/thirdparty/BLTSetupOpenMP.cmake index b58b35767..93971464b 100644 --- a/cmake/thirdparty/BLTSetupOpenMP.cmake +++ b/cmake/thirdparty/BLTSetupOpenMP.cmake @@ -65,6 +65,14 @@ endif() message(STATUS "BLT OpenMP Compile Flags: ${_compile_flags}") message(STATUS "BLT OpenMP Link Flags: ${_link_flags}") +# COMPILE_OPTIONS and INTERFACE_COMPILE_OPTIONS are semicolon-delimited lists, +# but the string in _compile_flags may be a space-delimited string of command line options. +# "SHELL:" causes the flags to be not de-duplicated and parsed with separate_arguments. +# Ref https://github.com/llnl/blt/issues/723 +if(NOT "${_compile_flags}" MATCHES SHELL:) + set(_compile_flags "SHELL:${_compile_flags}") +endif() + blt_import_library(NAME openmp COMPILE_FLAGS ${_compile_flags} LINK_FLAGS ${_link_flags}