Help: target_include_directories should mention genex quoting
Hi guys,
Recently I'm trying to export all wxwidgets targets by refactor the code about target_include_directories
in my PR https://github.com/microsoft/vcpkg/pull/17111.
And I found something unexpected:
When we use the keyword BUILD_INTERFACE
and pass in multiple macros after it and separate them with semicolons, the actual generated include header file path will use slashes to merge all paths together.
Example:
target_include_directories(main PUBLIC $<BUILD_INTERFACE:${INC1};${INC2}>)
This will generated a compiler option when using Visual Studio:
-I${INC1}\${INC2}
The expect behavor is generated -I${INC1} -I${INC2}
.
After re-reading the latest document in detail, I did not see that multiple paths are banned behind BUILD_INTERFACE
. That seems to provide this is a bug, right?
At last, it will be resolved by setting each macro individually:
target_include_directories(main PUBLIC $<BUILD_INTERFACE:${INC1}> $<BUILD_INTERFACE:${INC2}>)
This isue is very interesting, can anyone explain it?
Thanks,
Jack