When "SHELL:" is used with generator expressions, deduplication is still applied
When calling:
target_compile_options(target PRIVATE "SHELL:-option A")
target_compile_options(target PRIVATE "SHELL:-option B")
SHELL:...
can be used to avoid deduplication of -option
.
However, when this construction is used with generator expressions, the deduplication is still applied and breaks compilation.
For example:
target_compile_options(${testName} BEFORE PRIVATE
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:GNU>>:SHELL:-include "fileA.h" >)
target_compile_options(${testName} BEFORE PRIVATE
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:GNU>>:SHELL:-include "fileB.h" >)
The result at the command line is -include fileA.h fileB.h
instead of -include fileA.h -include fileB.h
.
Note: If I enclose the entire SHELL option in double quotes:
target_compile_options(${testName} BEFORE PRIVATE
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:GNU>>:"SHELL:-include fileA.h" >)
target_compile_options(${testName} BEFORE PRIVATE
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:GNU>>:"SHELL:-include fileB.h" >)
The result at the command line is "\"SHELL:-include fileA.h\"" "\"SHELL:-include fileB.h\""