Search code examples
visual-studioprojects-and-solutionsinclude-path

How do I add an additional #include path to Visual Studio properties relative to the PARENT of the solution Directory?


I need to enable developers to work on a collection of VS solutions in both 2017 and 2019 IDE's. I want to separate the code from the solution and project files, so I'm looking for a file structure like this:

root
/solutions_2017
    sol_1.sln
    sol_2.sln
    /projects
        /lib1
            lib1.vcxproj
            lib1.vcxproj.user
            lib1.vcxproj.filters
        /lib2
            lib2.vcxproj
            lib2.vcxproj.user
            lib2.vcxproj.filters            
        /unit_tests
            ...
        /app
            ...

/solutions_2019
    sol_1.sln
    sol_2.sln   
    /projects
        /lib1
        /lib2
        /unit_tests
        /app
/code
    /lib1
        ...h
        ...cpp
    /lib2
        ...h
        ...cpp
    /unit_tests
        ...h
        ...cpp
    /app
        ...cpp

Basically, I need to provide relative paths to the PARENT of $(SolutionDir) in the project C/C++-> General-> Additional Include Directories... But if I try $(Solution)../code/ it treats ../ as a literal instead of a parent directory. Any ideas how to deal with this scenario?


Solution

  • But does the compiler translate that ..\ and actually find the header files? The "Evaluated value" is just what happens after the macro is substituted; any file searcher parsing "C:\myRoot\solutions_2017..\code" should give what you want.