All,
Thank you in advance,
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!
I seem to have uncovered a bug where one CSharp project depends on another.
The first CMakeLists.txt:
cmake_minimum_required(VERSION 3.12)
project(DockPanel CSharp)
...
add_library(DockPanel MODULE ${SOURCES_files_Compile}
${SOURCES_files_EmbeddedResource})
set_property(TARGET DockPanel APPEND PROPERTY VS_DOTNET_REFERENCES "System")
The second CMakeLists.txt:
cmake_minimum_required(VERSION 3.12)
project(CSharpFramework CSharp)
...
add_library(CSharpFramework MODULE ${SOURCES_files_Compile}
${SOURCES_files_EmbeddedResource})
target_link_libraries(CSharpFramework PUBLIC $<$<CONFIG:Debug>:DockPanel> )
set_property(TARGET CSharpFramework APPEND PROPERTY VS_DOTNET_REFERENCES
"System")
(I haven't shown everything, as I'm extracting these from a huge system, but I
can elaborate if necessary...)
CMake configures and generates (to VS2015) without error. Things proceed as
expected until it's time to link the second project.
Then, I get:
..\DockPanel\Debug\DockPanel.dll : fatal error LNK1107: invalid or corrupt
file: cannot read at 0x358
A bit of investigative work shows that the generated CSharpFramework.vcxproj
contains, as expected:
<ProjectReference
Include="D:\Havok\hk2014_2_5_Simulation\Source\build-x64-msvc-v140-\Vision\Editor\vForge\DockPanel\DockPanel.vcxproj">
<Project>{DCCB7EE9-726F-3D42-A673-D6CCB4EF6675}</Project>
<Name>DockPanel</Name>
</ProjectReference>
But, it also contains:
<Link>
<AdditionalDependencies>..\DockPanel\Release\DockPanel.dll;
...</AdditionalDependencies>
...
</Link>
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.
Can you confirm that this is a bug?
Thank you,
Phil
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake