VS: Providing the `/AI` compiler option results in two `<AdditionalUsingDirectories>` elements
I have a managed C++ target AAA that depends on a native C++ static library BBB and another managed C++ target CCC. In AAA, I must use CCC as friend:
#using "CCC.dll" as_friend
For this to work, I need to provide CCC.dll
's folder with /AI
compiler option:
target_compile_options(AAA PRIVATE /AI"${CMAKE_BINARY_DIR}/bin")
In the generated project file AAA.vcxproj
, I expect to see the <AdditionalUsingDirectories>
XML element that contains the expanded value of "${CMAKE_BINARY_DIR}/bin"
. And I do see it, but then in the same <ClCompile>
XML element there is the second <AdditionalUsingDirectories>
XML element that contains the library directory of BBB
. This second <AdditionalUsingDirectories>
overwrites the folder that I set with /AI
compiler option. The #using
statement results in compilation errors, and there seems to be no way to fix the problem from my CMakeLists.txt
.
The expected behavior would be to generate one <AdditionalUsingDirectories>
XML element that merges paths coming from my /AI
option and paths coming from dependencies.