AdditionalIncludeDirectories are missed in vcxproj

Hello,

I am using GitHub Actions for my open-source project: GitHub - matwey/libopenvizsla at github-actions
While trying to fix the build for Windows, I’ve faced an issue which I could not reproduce in my environment.
Both environments uses cmake 3.23, and same vcpkg versions are in use. However the environments produce different vcxproj files for the same CMakeLists.txt.

Critical difference that cmake at GitHub doesn’t use include paths for the resource compiler while local cmake does:

     <ResourceCompile>
       <PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;_WINDOWS;NDEBUG;_XOPEN_SOURCE;_XOPEN_SOURCE_EXTENDED;CMAKE_INTDIR=\"Release\";openvizsla_EXPORTS</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>D:\a\libopenvizsla\libopenvizsla\include;D:\a\libopenvizsla\libopenvizsla\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>C:\Users\User\libopenvizsla\include;C:\Users\User\libopenvizsla\build;C:\Users\User\vcpkg\installed\x64-windows\include\libusb-1.0;C:\Users\User\vcpkg\installed\x64-windows\include\libftdi1;C:\Users\User\vcpkg\installed\x64-windows\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ResourceCompile>

This leads to resource compilation failure due to required header file cannot be opened.

Include paths for comping the code are file in both cases:

     <ClCompile>
-      <AdditionalIncludeDirectories>C:\vcpkg\installed\x64-windows\debug\lib\pkgconfig\..\..\..\include\libusb-1.0;C:\vcpkg\installed\x64-windows\debug\lib\pkgconfig\..\..\..\include\libftdi1;C:\vcpkg\installed\x64-windows\debug\lib\pkgconfig\..\..\..\include;D:\a\libopenvizsla\libopenvizsla\include;D:\a\libopenvizsla\libopenvizsla\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>C:\Users\User\libopenvizsla\include;C:\Users\User\libopenvizsla\build;C:\Users\User\vcpkg\installed\x64-windows\include\libusb-1.0;C:\Users\User\vcpkg\installed\x64-windows\include\libftdi1;C:\Users\User\vcpkg\installed\x64-windows\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <ExceptionHandling>
@@ -272,10 +272,10 @@
     </ClCompile>

How could I debug this issue further? Because I have no idea what could be wrong here.

One machine seems to have ../ in those paths. There are situations that can confuse CMake in the presence of junctions or reparse points. Are you sure the vcpkg environments are the same on these two machines?

Thank you. Your hint was very helpful. I think I’ve found the difference. GitHub actions has pkg-config installed. My CMakeLists.txt supports both pkg-config for UNIX systems and fallback to find_library for Windows. However, pkg-config produces unnormalized paths on Windows.

In that case, it might be that pkg-config is causing the GHA instance to go down some wrong assumptions about installation layouts and such. You can either update how you find your dependencies (i.e., not assume that pkg-config is the best way if it exists) or make it support whatever vcpkg is doing with .pc files here.

Why does ClCompile understand this paths while ResourceCompile doesn’t? Isn’t this should be fixed inside CMake?

:person_shrugging: rc.exe is a different tool from cl.exe. I can’t speak to why one might interpret paths differently than the other.