@@ -110,6 +110,25 @@ function scanner.find_compiler_pair(dir, c_compiler)
110110 return nil
111111end
112112
113+ function scanner .find_linker_pair (dir , linker_name )
114+ if not linker_name then
115+ return nil
116+ end
117+ local linker_path = dir .. " /" .. linker_name
118+ if scanner .file_exists (linker_path ) then
119+ return linker_path
120+ end
121+ return nil
122+ end
123+
124+ function scanner .get_toolchain_file ()
125+ local toolchainFile = os.getenv (" CMAKE_TOOLCHAIN_FILE" )
126+ if toolchainFile and scanner .file_exists (toolchainFile ) then
127+ return toolchainFile
128+ end
129+ return nil
130+ end
131+
113132function scanner .ensure_directory (path )
114133 local pattern = " (.*/)"
115134 local dir = path :match (pattern )
@@ -139,6 +158,11 @@ function scanner.scan_for_kits()
139158 local paths = scanner .split_path (path_env )
140159
141160 for _ , dir in ipairs (paths ) do
161+ local linker_path = scanner .find_linker_pair (dir , " lld" )
162+ if linker_path == nil then
163+ linker_path = scanner .find_linker_pair (dir , " ld" )
164+ end
165+ local toolchainFile = scanner .get_toolchain_file ()
142166 local gcc_path = dir .. " /gcc"
143167 if scanner .file_exists (gcc_path ) then
144168 local gcc_version = scanner .get_gcc_version (gcc_path )
@@ -150,6 +174,8 @@ function scanner.scan_for_kits()
150174 C = gcc_path ,
151175 CXX = gxx_path ,
152176 },
177+ linker = (linker_path or " " ),
178+ toolchainFile = (toolchainFile or " " ),
153179 }
154180 table.insert (kits , kit )
155181 end
@@ -166,6 +192,8 @@ function scanner.scan_for_kits()
166192 C = clang_path ,
167193 CXX = clangxx_path ,
168194 },
195+ linker = (linker_path or " " ),
196+ toolchainFile = (toolchainFile or " " ),
169197 }
170198 table.insert (kits , kit )
171199 end
0 commit comments