0

I'm trying to make a generic property sheet for our C++ projects in Visual Studio. For example, to point to the boost library (which is downloaded from a server into the git checkout directory by a script).

Lets say I have a folder structure like this:

  • checkout_dir
    • libraries (filled by script)
      • boost
    • main_program
      • main_program.sln
      • main_program_project_1
        • main_program_project_1.vcxproj
      • main_program_project_2
        • main_program_project_2.vcxproj
    • tests
      • test_suite_1
        • test_suite_1.sln
        • test_suite_1_project
          • test_suite_1_project.vcxproj
      • test_suite_2
        • test_suite_2.sln
        • test_suite_2_project
          • test_suite_2_project.vcxproj
      • test_group
        • test_suite_3
          • test_suite_3.sln
          • test_suite_3_project
            • test_suite_3_project.vcxproj
        • test_suite_4
          • test_suit_4.sln
          • test_suite_4_project
            • test_suite_4_project.vcxproj

I would like to make a property sheet to point all of the projects (main and test) to the boost library. But the problem is that the boost library is not at the same relative path for each project because they are at different directory levels.

Is there a way to avoid making a property sheet for each directory level?

Thanks

Tekar
  • 105
  • 2
  • 8
  • [This](https://stackoverflow.com/questions/16876424/c-using-environment-variable-in-property-sheet-for-visual-studio-2010) may help. – Tryer Feb 07 '23 at 11:09
  • @Tryer: I see, I could somehow define an environment variable to point to the checkout_dir or libraries dir. But that would break if I have multiple checkouts (different versions). I'll need to find a way to make it work with multiple checkouts. – Tekar Feb 07 '23 at 11:22
  • I ended up making a couple of special property sheets that each define a CheckoutDir macro: define_checkoutdir_1up.prop: $(SolutionDir)..\ define_checkoutdir_2up.prop: $(SolutionDir)..\..\ define_checkoutdir_3up.prop: $(SolutionDir)..\..\..\ If I place one of these earlier in evaluation then the later property sheets can use $(CheckoutDir) as an absolute reference. – Tekar Feb 13 '23 at 15:49

0 Answers0