I’m trying to create a Pybind11 Python module (exactly a .dll
file) called CAVSim
with Visual Studio 2022.
I can simply make VS output a file named CAVSim.pyd
by configuring Advanced-Target File Extension
as .pyd
.
Now I want to output file with name like CAVSim.cp39-win_amd64.pyd
to differ modules for different version of python when uploading them to GitHub.
But when I set the Advanced-Target File Extension
of the project property to .cp39-win_amd64.pyd
, I got warnings like this in compiling:
1>...Microsoft.CppBuild.targets(1393,5): warning MSB8012: TargetExt(.cp39-win_amd64.pyd) does not match the Linker's OutputFile property value (.pyd). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1>...Microsoft.CppBuild.targets(1394,5): warning MSB8012: TargetName(CAVSim) does not match the Linker's OutputFile property value (CAVSim.cp39-win_amd64). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
Also I’ve tried changing Linker-General-Output File
as $(OutDir)$(TargetName).$(CPythonVersion)-win_$(ProcessorArchitecture)$(TargetExt)
instead, but got similar warnings.
The binary files generated after the warnings has correct file name and works right. So I think the configuration above are to some extend RIGHT, BUT NOT PROPER.
My question is, how can I configure the project PROPERLY, to get the right output file name CAVSim.cp39-win_amd64.pyd
without accepting the warnings above?