Skip to content

Commit af6ac18

Browse files
committed
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
1 parent b01fb10 commit af6ac18

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmake/BLTInstallableMacros.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,13 @@ macro(blt_add_target_compile_flags)
412412
# Only add the flag if it is not empty
413413
string(STRIP "${arg_FLAGS}" _strippedFlags)
414414
if(NOT "${_strippedFlags}" STREQUAL "")
415+
# COMPILE_OPTIONS and INTERFACE_COMPILE_OPTIONS are semicolon-delimited lists,
416+
# but the string in arg_FLAGS may be a space-delimited string of command line options.
417+
# Note: "SHELL:"" causes the flags to be not de-duplicated and parsed with
418+
# separate_arguments
419+
if(NOT "${_strippedFlags}" MATCHES SHELL:)
420+
set(_strippedFlags "SHELL:${_strippedFlags}")
421+
endif()
415422
get_target_property(_target_type ${arg_TO} TYPE)
416423
if (("${_target_type}" STREQUAL "INTERFACE_LIBRARY") AND (${CMAKE_VERSION} VERSION_LESS "3.11.0"))
417424
set_property(TARGET ${arg_NAME} APPEND PROPERTY

0 commit comments

Comments
 (0)