I'm trying to port a project from Visual Studio 2013 to cmake and I'm facing a problem with Midl compiler.
The original project has a project.vcxproj file which have kind of:
<ItemGroup>
<Midl Include="project.idl">
<TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug/project.tlb</TypeLibraryName>
<HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">project_Interface.h</HeaderFileName>
<DllDataFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">dlldata.c</DllDataFileName>
<InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">project_Interface.c</InterfaceIdentifierFileName>
<MkTypLibCompatible Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</MkTypLibCompatible>
</Midl>
</ItemGroup>
After this ItemGroup there is other ItemGroup with the Source code ClInclude, etc.
My problem is that with kind of this cmake code:
set(MIDL_FILE
project.idl
)
add_executable(${PROJECT_NAME} WIN32 ${SOURCE_FILES} ${HEADER_FILES} ${MIDL_FILE})
This generate a project.vcxproj which had a unique ItemGroup with something like:
<ItemGroup>
<ClInclude Include="file.h" />
<Midl Include="project.idl" />
</ItemGroup>
Here the problem is that with this project the project_Interface.h is not generated. I have add manually the snippet that I shared, that is add the other ItemGroup and it is able to invoke the midl compiler and generates the files.
I saw that the midl is invoked. However, the settings seems to be taken from this:
<Midl>
<OutputDirectory>$(ProjectDir)/$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
This generated the project.h, is there any way of change these attributes?
I have tried with VS_GLOBAL_<variable> and I saw that this entry is generated in <PropertyGroup Label="Globals">. However this is no used in midl compiler call.
Here the thing is:
- Is there any way of change the midl settings?
- Is there any way of define a custom
ItemGroupwith specific settings?
Thanks in advance