diff options
| author | Arthur LAURENT <[email protected]> | 2024-03-12 16:59:25 +0100 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2024-03-23 23:56:38 +0100 |
| commit | b3115d8c98fda1a727f81e47b3dd2e353c9df5e2 (patch) | |
| tree | c3c2723b23fb5f36fabfba89ce83f833a5a161c6 | |
| parent | 11282b572ba6e86a0dbd83fe9876f5dbe22f9ab2 (diff) | |
apply PR suggestion
| -rw-r--r-- | xmake/rules/c++/modules/modules_support/clang/compiler_support.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua b/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua index ced45cf34..7fba1054a 100644 --- a/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua +++ b/xmake/rules/c++/modules/modules_support/clang/compiler_support.lua @@ -270,11 +270,13 @@ function get_stdmodules(target) local modules_json_path = _get_std_module_manifest_path(target) if modules_json_path then local modules_json = json.decode(io.readfile(modules_json_path)) - local std_module_directory = path.directory(modules_json.modules[1]["source-path"]) - if not path.is_absolute(std_module_directory) then - std_module_directory = path.join(path.directory(modules_json_path), std_module_directory) + if modules_json and modules_json.modules and #modules_json.modules > 0 then + local std_module_directory = path.directory(modules_json.modules[1]["source-path"]) + if not path.is_absolute(std_module_directory) then + std_module_directory = path.join(path.directory(modules_json_path), std_module_directory) + end + return {path.join(std_module_directory, "std.cppm"), path.join(std_module_directory, "std.compat.cppm")} end - return {path.join(std_module_directory, "std.cppm"), path.join(std_module_directory, "std.compat.cppm")} end elseif cpplib == "stdc++" then -- libstdc++ doesn't have a std module file atm |
