<div dir="ltr">Hi<div>here is all the property I had to set to produce C++/CLI (clr) targets with cmake</div><div><br></div><div><div><br></div><div>    target_compile_options(${project_name} PRIVATE /clr)</div><div>    target_compile_options(${project_name} PRIVATE /fp:precise) # /fp:strict is incompatible with /clr</div><div><br></div><div>    set_property(TARGET ${project_name} PROPERTY VS_GLOBAL_ROOTNAMESPACE ${project_name})</div><div><br></div><div>    set_property(TARGET ${project_name} PROPERTY VS_GLOBAL_KEYWORD "ManagedCProj")</div><div><br></div><div>    set_property(TARGET ${project_name} PROPERTY VS_GLOBAL_CLRSupport "true")</div><div><br></div><div>    set_property(TARGET ${project_name} PROPERTY VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.0")</div><div><br></div><div>    set_property(TARGET ${project_name} PROPERTY VS_DOTNET_REFERENCES "System" "System.Data" "System.Drawing" "System.Windows.Forms" "System.Xml")</div><div><br></div><div>    # Note: Modification of compiler flags is required for CLR compatibility now that we are using .resx files.</div><div>    string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")</div><div>    string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-10-19 12:08 GMT+02:00 Swetha Sharma <span dir="ltr"><<a href="mailto:swetha.bsharma@gmail.com" target="_blank">swetha.bsharma@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am trying to create a managed c++ code , i want to thes clrsupport to be true from cmake. Below is the script which  i have used<div><br></div><div><span style="font-size:12.8px">SET_TARGET_PROPERTIES(${</span><span style="font-size:12.8px">PROJEC<wbr>T_NAME} PROPERTIES COMPILE_FLAGS "/clr")</span><br style="font-size:12.8px"><span style="font-size:12.8px"> STRING(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})</span><br style="font-size:12.8px"><span style="font-size:12.8px"> STRING(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})</span><br style="font-size:12.8px"><span style="font-size:12.8px"> SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /clr")</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">The problem I've found, is that while CMake sets the "Common Language</span><br style="font-size:12.8px"><span style="font-size:12.8px">RunTime Support" option in the C/C++ section of the configuration properties</span><br style="font-size:12.8px"><span style="font-size:12.8px">if "/clr" is in the CXX_FLAGS, it does not set the "Common Language RunTime</span><br style="font-size:12.8px"><span style="font-size:12.8px">Support" in the general configuration properties, and that causes problems</span><br style="font-size:12.8px"><span style="font-size:12.8px">with linking/.NET references.</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">How do I fix this issue?</span></div><span class="HOEnZb"><font color="#888888"><div><span style="font-size:12.8px">-swetha</span></div></font></span></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/<wbr>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/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>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/<wbr>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/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="text-align:-webkit-auto;font-size:medium;font-family:Helvetica;word-wrap:break-word"><strong style="font-family:'Times New Roman';font-size:16px"><b><font size="1" color="#333333" face="Verdana"><span style="font-size:7.5pt">Benjamin BALLET</span></font></b></strong><font size="1" face="Verdana"><span style="font-size:7.5pt"><br><font color="#333333">Ingénieur R&D</font></span></font></div><div style="text-align:-webkit-auto;font-size:medium;font-family:Helvetica;word-wrap:break-word"><font size="1" face="Verdana"><span style="font-size:7.5pt"><br><strong><b><font color="#0e2a69" face="Verdana">ACTIVISU</font></b></strong></span></font></div><div style="text-align:-webkit-auto;font-size:medium;font-family:Helvetica;word-wrap:break-word"><font size="1" face="Verdana"><span style="font-size:7.5pt"><font color="#999999">19, rue Klock - 92110 Clichy</font></span></font></div><div style="text-align:-webkit-auto;font-size:medium;font-family:Helvetica;word-wrap:break-word"><span style="text-align:-webkit-auto;font-size:16px;font-family:'Times New Roman'"><b><font size="1" color="#031f63" face="Arial"><span style="font-size:7.5pt">> Standard Tél</span></font></b></span><font size="1" face="Verdana" style="text-align:-webkit-auto"><span style="font-size:7.5pt"> :  01 44 69 37 37</span></font><font size="1" face="Verdana"><span style="font-size:7.5pt"><font color="#999999"><br></font></span></font></div><div dir="ltr"><span style="font-size:16px;text-align:-webkit-auto;font-family:'Times New Roman'"><b><font size="1" color="#031f63" face="Arial"><span style="font-size:7.5pt">></span></font></b></span><font size="1" face="Verdana" style="text-align:-webkit-auto"><span style="font-size:7.5pt"> <a href="http://www.activisu.com/" style="color:purple" target="_blank">www.activisu.com</a></span></font></div></div></div></div></div></div></div></div></div></div></div>
</div>