Chromium Code Reviews| Index: tools/gn/config_values_generator.cc |
| diff --git a/tools/gn/config_values_generator.cc b/tools/gn/config_values_generator.cc |
| index f66ddfd688199e6c35e01abfd1cb23f84720d69e..5e2f65a45fcc1f00b948c5317cb08e16aed8a0ce 100644 |
| --- a/tools/gn/config_values_generator.cc |
| +++ b/tools/gn/config_values_generator.cc |
| @@ -4,6 +4,7 @@ |
| #include "tools/gn/config_values_generator.h" |
| +#include "base/strings/string_util.h" |
| #include "tools/gn/config_values.h" |
| #include "tools/gn/scope.h" |
| #include "tools/gn/settings.h" |
| @@ -81,4 +82,34 @@ void ConfigValuesGenerator::Run() { |
| #undef FILL_STRING_CONFIG_VALUE |
| #undef FILL_DIR_CONFIG_VALUE |
| + |
| + // Precompiled headers. |
| + const Value* precompiled_header_value = |
| + scope_->GetValue(variables::kPrecompiledHeader, true); |
| + if (precompiled_header_value) { |
| + if (!precompiled_header_value->VerifyTypeIs(Value::STRING, err_)) |
| + return; |
| + |
| + // Check for common errors. This is a string and not a file. |
| + const std::string& pch_string = precompiled_header_value->string_value(); |
| + if (base::StartsWith(pch_string, "//", base::CompareCase::SENSITIVE)) { |
| + *err_ = Err(*precompiled_header_value, |
| + "This precompiled_header value is wrong.", |
| + "You need to specify a string that the compiler will match exactly\n" |
| + "against your #includes rather than a GN-style file name."); |
|
scottmg
2015/06/26 22:30:13
"match exactly against your #includes" isn't too c
|
| + return; |
| + } |
| + config_values_->set_precompiled_header(pch_string); |
| + } |
| + |
| + const Value* precompiled_source_value = |
| + scope_->GetValue(variables::kPrecompiledSource, true); |
| + if (precompiled_source_value) { |
| + config_values_->set_precompiled_source( |
| + input_dir_.ResolveRelativeFile( |
| + *precompiled_source_value, err_, |
| + scope_->settings()->build_settings()->root_path_utf8())); |
| + if (err_->has_error()) |
| + return; |
| + } |
| } |