@@ -250,7 +250,7 @@ build bin/Debug/MyProject2.dll | bin/Debug/MyProject2.exp bin/Debug/MyProject2.l
250250-- Test that shared library on Windows with NoImportLib flag works correctly with GCC
251251--
252252
253- function suite .sharedLibWindowsGCCNoImportLib ()
253+ function suite .sharedLibWindowsGCCNoImportLib_ViaFlag ()
254254 local wks = test .createWorkspace ()
255255 configurations { " Debug" }
256256 toolset " gcc"
@@ -279,11 +279,39 @@ build bin/Debug/MyProject2.dll | bin/Debug/MyProject2.exp: link_gcc obj/Debug/ma
279279 end
280280
281281
282+ function suite .sharedLibWindowsGCCUseImportLibOff_ViaAPI ()
283+ local wks = test .createWorkspace ()
284+ configurations { " Debug" }
285+ toolset " gcc"
286+ _OS = " windows"
287+
288+ local prj = test .createProject (wks )
289+ kind " SharedLib"
290+ language " C++"
291+ files { " main.cpp" }
292+ useimportlib " Off"
293+ toolset " gcc"
294+
295+ local cfg = test .getconfig (prj , " Debug" )
296+
297+ -- Set up object files list (normally done by buildFiles)
298+ cfg ._objectFiles = { " obj/Debug/main.o" }
299+
300+ -- Call linkTarget and check output
301+ ninja .cpp .linkTarget (cfg )
302+
303+ test .capture [[
304+ build bin/Debug/MyProject2.dll | bin/Debug/MyProject2.exp: link_gcc obj/Debug/main.o
305+ ldflags = $ldflags_MyProject2_Debug
306+ ]]
307+ end
308+
309+
282310--
283311-- Test that shared library on Windows with NoImportLib flag works correctly with MSVC
284312--
285313
286- function suite .sharedLibWindowsMSVCNoImportLib ()
314+ function suite .sharedLibWindowsMSVCNoImportLib_ViaFlag ()
287315 local wks = test .createWorkspace ()
288316 configurations { " Debug" }
289317 toolset " msc"
@@ -312,6 +340,34 @@ build bin/Debug/MyProject2.dll | bin/Debug/MyProject2.exp: link_msc obj/Debug/ma
312340 end
313341
314342
343+ function suite .sharedLibWindowsMSVCUseImportLibOff_ViaAPI ()
344+ local wks = test .createWorkspace ()
345+ configurations { " Debug" }
346+ toolset " msc"
347+ _OS = " windows"
348+
349+ local prj = test .createProject (wks )
350+ kind " SharedLib"
351+ language " C++"
352+ files { " main.cpp" }
353+ useimportlib " Off"
354+ toolset " msc"
355+
356+ local cfg = test .getconfig (prj , " Debug" )
357+
358+ -- Set up object files list (normally done by buildFiles)
359+ cfg ._objectFiles = { " obj/Debug/main.obj" }
360+
361+ -- Call linkTarget and check output
362+ ninja .cpp .linkTarget (cfg )
363+
364+ test .capture [[
365+ build bin/Debug/MyProject2.dll | bin/Debug/MyProject2.exp: link_msc obj/Debug/main.obj
366+ ldflags = $ldflags_MyProject2_Debug
367+ ]]
368+ end
369+
370+
315371--
316372-- Test the shared library not on Windows does not create exp or lib files
317373--
0 commit comments