VS: Building a Windows Driver using vcxproj
I am having problems with getting the driver .sys file signed in our CI pipeline.
I had been using the v142 toolset for building the drivers and created a custom task to call signtool to sign the driver. Although that works on my dev box, it failed on CI pipeline as signtool could not find a suitable cert. Of course I could add further custom actions to create a self signed certificate with code signing EKU; but then I figured that vcxproj generated by VS does this automatically.
Upon investigation again, the following properties made all the difference.
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>KMDF</DriverType>
If I add these properties in the vcxproj generated by cmake the .sys file does get signed automatically. However I am now back to the original issue I was facing mentioned this this thread:
ZERO_CHECK.vcxproj : error MSB4057: The target "GetDriverProjectAttributes" does not exist in the project.
I found this potential solution: https://discourse.cmake.org/t/unable-to-fully-build-windows-umdf-driver-using-cmake/2368
Adding the following two lines in ZERO_CHECK.vcxproj indeed fixes it.
But the solution is hacky.
What is the recommended way of building windows drivers using CMake? What is the correct platform toolset to use? How can I get these binaries automatically test-signed just like Visual Studio does?