summaryrefslogtreecommitdiff
path: root/source/slang/slang-options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-options.cpp')
-rw-r--r--source/slang/slang-options.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index 7337b9210..857f4272c 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -2909,7 +2909,23 @@ SlangResult OptionsParser::_parse(
// Copy all settings from linkage to targets.
for (auto target : linkage->targets)
+ {
target->getOptionSet().inheritFrom(linkage->m_optionSet);
+
+ // If there is no target specified in command line, we should inherit the default target options.
+ if(m_rawTargets.getCount() == 0)
+ {
+ target->getOptionSet().inheritFrom(m_defaultTarget.optionSet);
+ }
+ }
+
+ // If there are no targets specified in command line, and addCodeGenTarget() is not called
+ // yet, the options for the default target will be gone after option parsing. We
+ // should save the option for the future use when addCodeGenTarget() is called.
+ if ((linkage->targets.getCount() == 0) && (m_rawTargets.getCount() == 0))
+ {
+ m_requestImpl->m_optionSetForDefaultTarget = m_defaultTarget.optionSet;
+ }
applySettingsToDiagnosticSink(m_requestImpl->getSink(), m_sink, linkage->m_optionSet);