I have a project that makes use of managed code and is compiled using
the /clr option.
1 ) In order to set up cmake correctly I had to issue the following command:
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/clr")
#mark as managed code
This was not sufficient because cmake added other options by default
(/EHsc and /RTC1) which are not compatible with /clr.
I had to disable them by manually replacing the cmake flags strings:
if(CMAKE_CXX_FLAGS_DEBUG MATCHES "/RTC1")
string(REPLACE "/RTC1" " " CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS ${PROJECT_NAME} " CMAKE_CXX_FLAGS_DEBUG removing /RTC1")
endif()
if(CMAKE_CXX_FLAGS MATCHES "/EHsc")
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
message(STATUS ${PROJECT_NAME} " CMAKE_CXX_FLAGS removing /EHsc")
endif()
Is this the only way to perform that or there is a more elegant way?
2) In the same managed project I am importing 3rd party dlls which are
referenced in the code as
#using [3dpparty.dll]
In order to set up the folder containing the dlls I use the visual
studio compiler option /AI (which corresponds to the "Resolve #using
Reference" field in the project properties).
Since I did not find a way to fix it explicitly using a cmake command I
modified the cmake compiler flags as follows:
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /AI\"${3DPARTY_FOLDER}\" ")
Again, is this the only way to perform that or there is a more elegant way?
Thanks,
Pierluigi
_______________________________________________
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