I still really need help with this. It's a blocker at this point for me. Help is greatly appreciated; thanks in advance.
On Sun, Nov 9, 2014 at 10:02 PM, Robert Dailey <rcdailey.li...@gmail.com> wrote: > When setting up a CLR project through CMake, it becomes important to > be able to *remove* compiler options at the project level. For > example, the following need to be removed (MSVC12): > > /RTC1 > /EHsc > > There is no "remove_compile_options()" (which would be convenient). > Any reason why this doesn't exist? > > Right now I'm trying to remove these via CMAKE_CXX_FLAGS locally but > this doesn't work unless I forcefully change the cache. But this is a > permanent operation that affects *all* projects, which I do not want. > This is crazy, I'm hoping there is a better way. I'm using CMake 3.1 > RC1. Can anyone help me figure out how to remove compiler options on a > per-project basis? > > Here is what I'm doing: > > function( add_clr_library target_name references ) > set( source_files ${ARGN} ) > > set( default_references > System > System.Core > System.Data > System.Drawing > #System.Xml > #WindowsBase > ) > > if( CMAKE_CXX_FLAGS_DEBUG MATCHES "/RTC1" ) > string( REGEX REPLACE "/RTC(su|[1su])" "" > CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" ) > endif() > > if( CMAKE_CXX_FLAGS MATCHES "/EHsc" ) > string( REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" ) > endif() > > add_library( ${target_name} SHARED ${source_files} ) > > list( APPEND references ${default_references} ) > > set_target_properties( ${target_name} PROPERTIES > VS_DOTNET_REFERENCES "${references}" > VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5" > COMPILE_FLAGS "/clr /EHa" > DEBUG_POSTFIX "d" > ) > endfunction() -- 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: http://public.kitware.com/mailman/listinfo/cmake