<div><div dir="auto">Also, this ticket seems to be very similar to what you are seeing if you dig down a bit:</div></div><div dir="auto"><br></div><div dir="auto"><div><a href="https://gitlab.kitware.com/cmake/cmake/issues/17678">https://gitlab.kitware.com/cmake/cmake/issues/17678</a></div><div dir="auto"><br></div><div dir="auto">But again, I do this exact same thing with Shared instead of Module libraries and it works. I would think that modules shouldn’t even be allowed for C# targets as that is a specific notion to open native libs with dlopen(). That ticket even hints at only allowing specific target types, possible module was just overlooked?</div><br></div><div dir="auto">-Caleb</div><div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 16, 2018 at 6:55 PM J. Caleb Wherry <<a href="mailto:calebwherry@gmail.com">calebwherry@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="auto">FWIW: I do almost this exact thing currently and have no issues (even mix in Managed C++ wrappers around naive code). The only difference is that I don’t compile any C# modules, only Shared libs. Not sure if that could be a problem or not.</div></div><div dir="auto"><br></div><div dir="auto">I’m using CMake 3.11 and VS 2015.</div><div dir="auto"><br></div><div dir="auto">-Caleb</div><div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 16, 2018 at 5:46 PM Craig Scott <<a href="mailto:craig.scott@crascit.com" target="_blank">craig.scott@crascit.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Philip, thanks for the concise description of the problem. Would you be willing to report this in CMake's gitlab as an issue so we can better track it and refer to it in merge requests, etc.? You can report a new issue here:<div><br></div><div><a href="https://gitlab.kitware.com/cmake/cmake/issues/new" target="_blank">https://gitlab.kitware.com/cmake/cmake/issues/new</a><br></div><div><br></div><div>Thanks</div><div><br></div></div><div class="gmail_extra"></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 17, 2018 at 1:59 AM, Tessier, Philip @ Engility via CMake <span dir="ltr"><<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p><span style="font-size:12pt">All,</span></p>
<div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<div>
<p>Thank you in advance,<br>
</p>
<p><br>
</p>
<p>I'm an experienced CMake user, in the C++ realm. I'm presently working outside that realm, porting a 200-project solution from Visual Studio (.vcxproj, .csproj) files to CMake. I'm very pleased that CMake has adopted CSharp! Thank you!<br>
</p>
<p><br>
</p>
<p>I seem to have uncovered a bug where one CSharp project depends on another.<br>
</p>
<p><br>
</p>
<p>The first CMakeLists.txt:<br>
</p>
<div>cmake_minimum_required(VERSION 3.12)<br>
</div>
<div>project(DockPanel CSharp)</div>
<div>...<br>
<div>add_library(DockPanel MODULE ${SOURCES_files_Compile} ${SOURCES_files_EmbeddedResource})<br>
</div>
<div>
<div>set_property(TARGET DockPanel APPEND PROPERTY VS_DOTNET_REFERENCES "System")<br>
</div>
<div><br>
</div>
<br>
The second CMakeLists.txt:<br>
</div>
<div>
<div>cmake_minimum_required(VERSION 3.12)<br>
</div>
<div>project(CSharpFramework CSharp)</div>
<div>...</div>
<div>
<div>add_library(CSharpFramework MODULE ${SOURCES_files_Compile} ${SOURCES_files_EmbeddedResource})</div>
<div>
<div>target_link_libraries(CSharpFramework PUBLIC <span style="font-size:12pt">$<$<CONFIG:Debug>:DockPanel></span><span style="font-size:12pt">  </span><span style="font-size:12pt">)</span></div>
<div>
<div>set_property(TARGET CSharpFramework APPEND PROPERTY VS_DOTNET_REFERENCES "System")</div>
<div><br>
</div>
(I haven't shown everything, as I'm extracting these from a huge system, but I can elaborate if necessary...)</div>
<div><br>
</div>
<div>CMake configures and generates (to VS2015) without error. Things proceed as expected until it's time to link the second project.</div>
<div>Then, I get:<br>
..\DockPanel\Debug\DockPanel.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x358<br>
<br>
</div>
A bit of investigative work shows that the generated CSharpFramework.vcxproj contains, as expected:<br>
<div>    <ProjectReference Include="D:\Havok\hk2014_2_5_Simulation\Source\build-x64-msvc-v140-\Vision\Editor\vForge\DockPanel\DockPanel.vcxproj"></div>
<div>      <Project>{DCCB7EE9-726F-3D42-A673-D6CCB4EF6675}</Project></div>
<div>      <Name>DockPanel</Name><br>
</div>
<div>    </ProjectReference><br>
</div>
<div><br>
</div>
<div>But, it also contains:<br>
<div>    <Link></div>
<div>    <AdditionalDependencies>..\DockPanel\Release\DockPanel.dll; ...</AdditionalDependencies><br>
</div>
<div>    ...<br>
</div>
<div> <span style="font-size:12pt">   </Link></span></div>
<div><br>
</div>
<div>The inclusion of DockPanel.dll in the AdditionalDependencies section is, I believe, causing Visual Studio to try to open it as a '.lib', and failing. I expected the generated .vcxproj to contain only the ProjectReference section for DockPanel, and not
 include it in AdditionalDependencies.<br>
</div>
</div>
<div><br>
</div>
<div>Can you confirm that this is a bug?<br>
</div>
<div><br>
</div>
<div>Thank you,<br>
</div>
<div>Phil<br>
</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<br>-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_8147195313170510649m_-1020628112819926940gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr">Craig Scott<br><div>Melbourne, Australia</div><div><a href="https://crascit.com" target="_blank">https://crascit.com</a><br></div><div><br></div><div>New book released: <a href="https://crascit.com/professional-cmake/" target="_blank">Professional CMake: A Practical Guide</a><br></div></div></div></div></div></div></div>
</div>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div></div>-- <br><div dir="ltr" class="m_8147195313170510649gmail_signature" data-smartmail="gmail_signature">Sent from my iPhone 4s</div>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Sent from my iPhone 4s</div>