I just got cmake working with C++ VS2010 .NET, so I thought I'd describe what I did, since the email archive and bug database were the most useful "tutorials" that I found.
My Goal: Create a VS2010/CLR project using cmake. My Approach: Create the most trivial code using VS2010, and get a cmake CMakeLists.txt that will compile it with nmake so that it runs (the "hello world" is created automatically by VS2010). At that point, I'll know I've got a working CMakeLists.txt for a .NET project. The steps: 0) Download cmake. 1) In VS2010 create a project and specify a console app using CLR. Try running it to make sure it prints "Hello World". (eg Projects\AJunkProj) 2) Create a parallel directory beside it in Projects. (eg. Projects\AJunkProjBld) 3) Create a CMakeLists.txt in Projects\AJunkProj\AJunkProj. File shown below. 4) Launch a shell window from inside VS2010 to run cmake (otherwise, cmake environment won't find compilation tools). cd to your build directory (eg. Projects\AJunkProjBld) 5) Run: cmake ..\AJunkProject\AJunkProject 6) At this point, for me, there were no errors. So Run: nmake 7) The executable should now exist for you to run (eg. AJunkProj.exe) In theory, you should be able to debug using nmake VERBOSE=1, though I only got it to display the first level of make commands. I then ran: cmake -G "Visual Studio 10" ..\AJunkProject\AJunkProject But I haven't inspected the generated project closely to see if it compiles properly (or at all.) # My CMakeLists.txt file PROJECT(AJunkProject) cmake_minimum_required(VERSION 2.8) SET(PROJ_SRCS AJunkProject.cpp AssemblyInfo.cpp stdafx.cpp ) # Mail archive recommended app.rc be added to file list later...don't know why. IF(WIN32) SET(PROJ_SRCS ${PROJ_SRCS} app.rc ) # add a -l<path> to the typical link line. TARGET_LINK_LIBRARIES( wsock32 ) ENDIF(WIN32) # where to find header files...slashes must by unix style INCLUDE_DIRECTORIES("C:/Program Files/Microsoft Visual Studio 10.0/VC/include") # From Mantis bug tracking notes...To set /clr flag for compiler STRING(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) STRING(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /clr") # set up a target ADD_EXECUTABLE(AJunkProject ${PROJ_SRCS}) #========== I realize that my CMakeLists.txt is still pretty rough. It has a couple of unneeded lines and should have more placed inside IF(WIN32), but I'm glad just to have it working. Thanks for creating cmake, Tony
_______________________________________________ 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