Our flag related macros have recently been unified to operate on lists (#305),
but our macro to generate flags -- blt_append_custom_compiler_flag -- only operates on strings, and the results are not directly compatible with our flag-related macros.
E.g. I'd expect the following to work:
blt_append_custom_compiler_flag(FLAGS_VAR _flags
DEFAULT " "
GNU "string-flag1 string-flag2" # space-delimited
CLANG list-flag1 list-flag2 # list
MSVC single )
blt_add_target_compile_flags(TO <target> SCOPE <scope> FLAGS ${_flags})
But, since the arguments to blt_append_custom_compiler_flag are strings rather than list (i.e. singleValuedArgs in our macro, rather than multiValuedArgs), only the first flag is used.
Note: I was able to get my example working (after some effort), but it is not as simple or obvious as it can be:
# Current workaround
blt_append_custom_compiler_flag(FLAGS_VAR _flags
DEFAULT " "
GNU "string-flag1 string-flag2"
CLANG "string-flag3 string-flag4"
MSVC single )
string (REPLACE " " ";" _flags "${_flags}")
blt_add_target_compile_flags(TO <target> SCOPE <scope> FLAGS ${_flags})
Note: This only works for space-delimited strings and requires a manual conversion from strings to lists.
Our flag related macros have recently been unified to operate on lists (#305), but our macro to generate flags --
blt_append_custom_compiler_flag
-- only operates on strings, and the results are not directly compatible with our flag-related macros.E.g. I'd expect the following to work:
But, since the arguments to
blt_append_custom_compiler_flag
are strings rather than list (i.e.singleValuedArgs
in our macro, rather thanmultiValuedArgs
), only the first flag is used.Note: I was able to get my example working (after some effort), but it is not as simple or obvious as it can be:
Note: This only works for space-delimited strings and requires a manual conversion from strings to lists.