13

I have a bunch of cmake generated projects and one which was created under MSVS. I want to have it added whenever I rerun cmake. Now I have to generate solution by cmake and then add existing project to the solution from the MSVS GUI but it is a bit tedious.

Is there a way to automatize the process?

ixSci
  • 10,620
  • 5
  • 35
  • 66

1 Answers1

25

I found a way to do it:

It is as simple as just put the following line in a cmake file: INCLUDE_EXTERNAL_MSPROJECT(<Name> <Path>)

I've also had dependencies in my MS project and those dependencies were on the projects generated by the CMake so I had to re-add deps every time I do clean build or change the machine I'm working on. It was solved with manually setting GUID for the CMake generated projects: SET(${PROJECT_NAME}_GUID_CMAKE "<GUID>" CACHE INTERNAL "Project GUID")

So now I can work with projects generated by CMake and "native" MSVS project without any pain.

ixSci
  • 10,620
  • 5
  • 35
  • 66
  • If you can or do not want to modify the MakeLists.txt, this can also be specified on the command line: `-D_GUID_CMAKE:INTERNAL=""` CMake will list this under "Manually-specified variables were not used by the project" but it'll work anyway. – foraidt Feb 05 '14 at 11:29
  • does it support other generators? – Serg Feb 01 '17 at 13:50
  • @Sergei, I have no idea – ixSci Feb 01 '17 at 14:07