zeroc-ice / ice-builder-visualstudio

Configure Ice Builder for MSBuild from Visual Studio
https://zeroc.com
BSD 3-Clause "New" or "Revised" License
29 stars 22 forks source link

Changing generated C++ header extension #2

Closed bernardnormier closed 6 years ago

bernardnormier commented 6 years ago

With slice2cpp, you can specify the extension of generated header files with the --header-ext command line option or with the global metadata cpp:header-ext in the Slice file.

The metadata is useful if you're not using the same header extension for all your Slice files, which should be uncommon. Ice's own Slice files use the metadata directive. This way, if your Slice file includes Ice/Identity.ice, the generated C++ code for your file will have #include <Ice/Identity.h> if even if you are using a different header extension for your generated header files.

If you specify the header extension through the slice2cpp command-line option and the metadata directive, the command-line option prevails.

With Ice Builder, you can specify the --header-ext command-line option (default = h) and Ice Builder uses this information to compute the header file name and include it in the project's Header Files filter. Ice Builder is however unaware of the metadata directives in the Slice file and will not behave properly if you change the C++ header extension through metadata. Having Ice Builder parse Slice files for metadata does not seem practical.

To avoid this problem, Ice Builder should always pass --header-ext to slice2cpp, even when the default (.h) extension is selected. This way, the header file generated by slice2cpp will always match Ice Builder's expectations. As of v5.0.1, when the default header extension is selected, Ice Builder does not pass --header-ext to slice2cpp.

The same discussion and conclusion applies to generated C++ source extension (.cpp by default). Changing the generated source extension should very uncommon, and furthermore doing so through metadata presents no advantage.

pepone commented 6 years ago

This is actually an issue in msbuild builder not appending the command line switch when using the default C++ header and source extensions

moved to zeroc-ice/ice-builder-msbuild#2