pavelliavonau / cmakeconverter

This project aims to facilitate the conversion of Visual Studio to CMake projects.
GNU Affero General Public License v3.0
858 stars 109 forks source link

Property file user macros not parsed ahead of time #126

Open palmada opened 3 years ago

palmada commented 3 years ago

Describe the bug I installed the latest version just now and tried to run on a project that has several .vcxproj in sub-folders. Because each of these might require common libraries stored elsewhere, I have defined a property file that includes the following:

  <PropertyGroup Label="UserMacros">
    <SpecificLibraryLocation>$(ENV_LOCATION)</SpecificLibraryLocation>
    <AnotherLibraryLocation>$(ANOTHER_ENV_LOCATION)</AnotherLibraryLocation>
  </PropertyGroup>

In my particular case, each is referring to an environment variable in path (so there are no hard-coded locations for external libraries in the code). However, whenever I try to run cmakeconverter I get the following type of error:

ERR : file:/path/to/vcxproj(71): /path/to/vcxproj/\$(SpecificLibraryLocation)/location/pointed/to/in/property/file/.vcxproj file not exists.

Since the error message shows the structure /path/to/vcxproj/, with \$(SpecificLibraryLocation) followed by /location/pointed/to/in/property/file/.vcxproj, I believe this error comes from not parsing user macros in property files ahead of time, as well as assuming all projects are in the same working directory.

To Reproduce Steps to reproduce the behavior:

  1. Create a solution with several vcxproj files
  2. Make each sub-project depend on an external library defined in a property file
  3. The library location should be pointed to by an environmental variable

Expected behavior The cmakeconverter should first read all property files and check for $(VAR) entries. Replace each with the corresponding environmental variable. Then load user macro entries as path variables, and parse project file locations accordingly.