Hi, I have a number of projects which contain mostly sub-directories with standard C++. I currently build all this stuff on Linux and Windows and everything is great. However I have a couple of directories in these projects which contain managed C++/CLI code so that I can expose the unmanaged C++ functionality to the rest of the Microsoft universe, obviously these directories build only on Windows. Currently I include the following snippet of CMake code, which I found on another post, to "fix" the compiler flags to enable the managed build
# Managed C++ set up set_target_properties(${TargetName} PROPERTIES COMPILE_FLAGS "/clr") if(CMAKE_CXX_FLAGS_DEBUG MATCHES "/RTC1") string(REPLACE "/RTC1" " " 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() My question is whether there is a better way to do this as the above seems a bit brittle and manual. For instance is it possible to define a new build configuration and somehow signal in the CMake input file that this directory should use it. In general what I want to be able to do is to indicate that a different set of default compile flags should be used for a given directory rather than the default. I am happy to spend time working on this and sharing any results but would appreciate any pointers from the CMake experts before I start so I don't go off wasting my time. David _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake