@@ -4341,6 +4341,46 @@ Environment TargetProperties::GetEnvironment() const {
4341
4341
return ComputeEnvironment ();
4342
4342
}
4343
4343
4344
+ Environment TargetProperties::GetInheritedEnvironment () const {
4345
+ Environment environment;
4346
+
4347
+ if (m_target == nullptr )
4348
+ return environment;
4349
+
4350
+ if (!m_collection_sp->GetPropertyAtIndexAsBoolean (
4351
+ nullptr , ePropertyInheritEnv,
4352
+ g_target_properties[ePropertyInheritEnv].default_uint_value != 0 ))
4353
+ return environment;
4354
+
4355
+ PlatformSP platform_sp = m_target->GetPlatform ();
4356
+ if (platform_sp == nullptr )
4357
+ return environment;
4358
+
4359
+ Environment platform_environment = platform_sp->GetEnvironment ();
4360
+ for (const auto &KV : platform_environment)
4361
+ environment[KV.first ()] = KV.second ;
4362
+
4363
+ Args property_unset_environment;
4364
+ m_collection_sp->GetPropertyAtIndexAsArgs (nullptr , ePropertyUnsetEnvVars,
4365
+ property_unset_environment);
4366
+ for (const auto &var : property_unset_environment)
4367
+ environment.erase (var.ref ());
4368
+
4369
+ return environment;
4370
+ }
4371
+
4372
+ Environment TargetProperties::GetTargetEnvironment () const {
4373
+ Args property_environment;
4374
+ m_collection_sp->GetPropertyAtIndexAsArgs (nullptr , ePropertyEnvVars,
4375
+ property_environment);
4376
+ Environment environment;
4377
+ for (const auto &KV : Environment (property_environment))
4378
+ environment[KV.first ()] = KV.second ;
4379
+
4380
+ return environment;
4381
+ }
4382
+
4383
+
4344
4384
void TargetProperties::SetEnvironment (Environment env) {
4345
4385
// TODO: Get rid of the Args intermediate step
4346
4386
const uint32_t idx = ePropertyEnvVars;
0 commit comments