<div dir="ltr"><div>    string( REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT ${CMAKE_CXX_FLAGS_INIT} )</div><div>    string( REPLACE "/EHsc" "" CMAKE_C_FLAGS_INIT ${CMAKE_C_FLAGS_INIT} )</div><div>    string( REPLACE "/EHs" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_INIT} )</div><div>    string( REPLACE "/EHs" "" CMAKE_C_FLAGS_INIT ${CMAKE_C_FLAGS_INIT} )</div><div>    string( REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} )</div><div>    # cannot set CLR for C code anyway</div><div>    #string( REPLACE "/RTC1" "/CLR" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG} )</div><div><br></div><div><br></div><div><div>However; this ends up being a global sort of thing... would be nice to be able to edit properties per target...</div></div><div><br></div><div>There's also a     <CLRSupport>true</CLRSupport>    flag in the project file that it doesn't look like cmake supports emitting at all... it's the setting that's in General Configuration Properties... doesn't look like it's required to compile and link as MSIL... but maybe that's where the setting to enable adding references is?  ... ya... clearing that removes COM and .NET assemblies from the reference add page; just solution targets are available...</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 16, 2014 at 11:08 PM, Domen Vrankar <span dir="ltr"><<a href="mailto:domen.vrankar@gmail.com" target="_blank">domen.vrankar@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This was asked a few years ago and I doubt that things have changed<br>
since then... <a href="http://www.cmake.org/pipermail/cmake/2010-May/036924.html" target="_blank">http://www.cmake.org/pipermail/cmake/2010-May/036924.html</a><br>
(<a href="http://www.cmake.org/cmake/help/v2.8.10/cmake.html#prop_sf%3aCOMPILE_FLAGS" target="_blank">http://www.cmake.org/cmake/help/v2.8.10/cmake.html#prop_sf%3aCOMPILE_FLAGS</a>).<br>
An alternative would be to use<br>
<a href="http://www.cmake.org/cmake/help/v3.0/module/ExternalProject.html" target="_blank">http://www.cmake.org/cmake/help/v3.0/module/ExternalProject.html</a><br>
<br>
Regards,<br>
Domen<br>
<div class="HOEnZb"><div class="h5"><br>
2014-12-17 4:49 GMT+01:00 Robert Dailey <<a href="mailto:rcdailey.lists@gmail.com">rcdailey.lists@gmail.com</a>>:<br>
> I still really need help with this. It's a blocker at this point for<br>
> me. Help is greatly appreciated; thanks in advance.<br>
><br>
> On Sun, Nov 9, 2014 at 10:02 PM, Robert Dailey <<a href="mailto:rcdailey.lists@gmail.com">rcdailey.lists@gmail.com</a>> wrote:<br>
>> When setting up a CLR project through CMake, it becomes important to<br>
>> be able to *remove* compiler options at the project level. For<br>
>> example, the following need to be removed (MSVC12):<br>
>><br>
>> /RTC1<br>
>> /EHsc<br>
>><br>
>> There is no "remove_compile_options()" (which would be convenient).<br>
>> Any reason why this doesn't exist?<br>
>><br>
>> Right now I'm trying to remove these via CMAKE_CXX_FLAGS locally but<br>
>> this doesn't work unless I forcefully change the cache. But this is a<br>
>> permanent operation that affects *all* projects, which I do not want.<br>
>> This is crazy, I'm hoping there is a better way. I'm using CMake 3.1<br>
>> RC1. Can anyone help me figure out how to remove compiler options on a<br>
>> per-project basis?<br>
>><br>
>> Here is what I'm doing:<br>
>><br>
>> function( add_clr_library target_name references )<br>
>>     set( source_files ${ARGN} )<br>
>><br>
>>     set( default_references<br>
>>         System<br>
>>         System.Core<br>
>>         System.Data<br>
>>         System.Drawing<br>
>>         #System.Xml<br>
>>         #WindowsBase<br>
>>     )<br>
>><br>
>>     if( CMAKE_CXX_FLAGS_DEBUG MATCHES "/RTC1" )<br>
>>         string( REGEX REPLACE "/RTC(su|[1su])" ""<br>
>> CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" )<br>
>>     endif()<br>
>><br>
>>     if( CMAKE_CXX_FLAGS MATCHES "/EHsc" )<br>
>>         string( REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )<br>
>>     endif()<br>
>><br>
>>     add_library( ${target_name} SHARED ${source_files} )<br>
>><br>
>>     list( APPEND references ${default_references} )<br>
>><br>
>>     set_target_properties( ${target_name} PROPERTIES<br>
>>         VS_DOTNET_REFERENCES "${references}"<br>
>>         VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5"<br>
>>         COMPILE_FLAGS "/clr /EHa"<br>
>>         DEBUG_POSTFIX "d"<br>
>>     )<br>
>> endfunction()<br>
> --<br>
><br>
> Powered by <a href="http://www.kitware.com" 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" 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" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" 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" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" 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" 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" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" 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" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div></div>