diff --git a/source/slang-core-module/CMakeLists.txt b/source/slang-core-module/CMakeLists.txt
index 67b0e9af26..50b45c90c9 100644
--- a/source/slang-core-module/CMakeLists.txt
+++ b/source/slang-core-module/CMakeLists.txt
@@ -152,7 +152,7 @@ set(core_module_common_args
 slang_add_target(
     ${core_module_common_args}
     TARGET_NAME slang-embedded-core-module
-    EXPLICIT_SOURCE ${core_module_generated_header}
+    REQUIRES generate_core_module_headers
     EXTRA_COMPILE_DEFINITIONS_PRIVATE SLANG_EMBED_CORE_MODULE
     INCLUDE_DIRECTORIES_PRIVATE ${core_module_generated_header_dir}
 )
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index 72756d3603..977cf322cc 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -2260,7 +2260,7 @@ SlangResult OptionsParser::_parse(int argc, char const* const* argv)
                     16,
                     &writer));
 
-                File::writeAllText(fileName.value, builder);
+                File::writeNativeText(fileName.value, builder.getBuffer(), builder.getLength());
                 break;
             }
         case OptionKind::DumpIrIds: