问题
I am unable to figure out how to change default build/compile settings. The little default checkbox in the lower left of the project options dialog is gone. The documentation states:
The Default checkbox that appeared at the lower edge of many Project Options pages has been removed from the product. If you want to specify options as the default for multiple projects, the suggested alternative is to use option sets instead.
I'm going round and round about "Options Sets", "Configuration Manager" etc.. Is this even possible? What does "specifying options as the default for multiple projects" mean? If I have multiple projects then that means those projects and their options exists, how can I set a default value to something already set? What about new projects?
回答1:
That feature really has gone and there is nothing like it any more in the product, to the very best of my knowledge. I think the best you can do is as follows:
- Create a new project.
- Change the project settings to whatever you want them to be.
- Change anything else in the default project that you don't like, for example
{ Private declarations }
. - Add this project to the repository.
- use File | New | Customize to move this project template onto the File | New menu for easy access.
回答2:
Project->Options->Target
. You can set up a base configuration, and then provide different options that differ from the base for Debug
and Release
. You can also create custom option sets, which means that they're different from the standard Debug
and Release
. You can also have different configurations based on different targets (VCL app's Debug build has different options than a FMX app's Debug build, etc.)
To change the default options first starts with defining "default". You can start as low as the "base configuration" through Project->Options->Delphi Compiler
, and then choosing the All Configuration
target. You can refine it somewhat by altering the base configuration for the Debug
and Release
configurations. You can also define your own option sets, using the Save
button next to the Target
list.
Your specific question about "specifying options as the default for multiple projects" means is the base configuration
. From there, you refine those base options to give you debug settings and release settings (which can also be saved as your initial defaults, and refined on a per-project basis).
So, for a specific answer, you can change the default by modifying the base configuration
, or by getting more specific by modifying the debug
or release
configurations that inherit from that base, depending on what your end result needs to be and what you're trying to accomplish.
来源:https://stackoverflow.com/questions/10134658/how-to-set-default-compiler-options-for-xe2