Valmond
Valmond

Reputation: 2969

MSVC handling lot of Include Paths

old time computer programmer having a new problem :-)

I'm moving a CMake file project over to Visual Studio and there are hundreds of include paths in the CMake project.

I can of course patch them in once and for all but this is going to happen often and on different machines where CMake have to be run again, using different parameters like library locations, also by different people so I'd like to have a neat way to treat this.

So my question is, can you in some way, paste those paths in a text file and add that to a visual studio project?

Any help greatly appreciated!

Upvotes: 0

Views: 70

Answers (2)

Valmond
Valmond

Reputation: 2969

So it seems it can't be done. As MSalters pointed out, most project files are in xml format so you have to update those manually.

I use MSVC 2012 (version 11.0.6...) so I opened the .vcxproj file in notepad++ and pasted the path accordingly in the tags of the concerned build variants for example "Debug|x64" and Release|x64".

Upvotes: 0

MSalters
MSalters

Reputation: 179887

The Visual Studio build files are XML, so it's almost-text.

What I'd do is create a single property sheet (.vsprops) inside Visual Studio, add it to your existing project(s), and then add two include directories to the .vsprops file. Close Visual Studio, open the .vsprops file in a text editor, check how the two paths are represented, and then add the several hundred paths in the same format.

Two remarks: Did you try the CMake MSVC generator? It might be able to do this for you. Secondly, have you considered this as a good moment to clean up the mess? Your builds will be slowed down quite a bit by the need to look up every header in hundreds of directories.

Upvotes: 1

Related Questions