CMake grouping/combining -include directives/flags
Hi!
I have a project where I have 2 -include BLAH
flags necessary. One is for a precompiled header, the other is just an include I need in some cases (e.g. Debug builds). I have two targets to which I attach the flags:
set_property(TARGET Blaze
APPEND PROPERTY
INTERFACE_COMPILE_OPTIONS
$<$<COMPILE_LANGUAGE:CXX>:-include csignal>)
and
set_property(TARGET ${SPECTRE_PCH}
APPEND PROPERTY INTERFACE_COMPILE_OPTIONS
$<$<COMPILE_LANGUAGE:CXX>:-include ${SPECTRE_PCH_HEADER_PATH}>
)
No amount of changing quotes, spacing, etc. has changed the results. The resulting compiler flags are
-include /home/nils/Downloads/spectre_builds/gcc_dbg/SpectrePch.hpp csignal
which GCC fails to parse and should really be
-include /home/nils/Downloads/spectre_builds/gcc_dbg/SpectrePch.hpp -include csignal
I'm not sure if this is an issue with Clang because there I need to use -include-pch
for the PCH, so I don't get 2 -include
but a -include
and a -include-pch
.
Am I doing something incorrect with how I'm setting up the flags and generator expressions or is this an actual CMake bug?
Thank you so much in advance!
Best wishes,
Nils