From fee4e26bdd51823a786e8bc18be5e5462da3f20f Mon Sep 17 00:00:00 2001 From: "M. Eric Irrgang" Date: Thu, 14 Aug 2025 16:53:27 -0700 Subject: [PATCH] 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