libiio icon indicating copy to clipboard operation
libiio copied to clipboard

Using libiio.pc for MSVC

Open gvanem opened this issue 2 years ago • 2 comments

The name of the library becomes libiio.lib after Cmake + Nmake finishes. But using the generated libiio.pc with this command pkg-config libiio --libs --msvc-syntax gives: /libpath:f:/ProgramFiler-x86/libiio/lib iio.lib

There's no iio.lib. Hence pkg-config is unusable for MSVC. Only works for MinGW: pkg-config libiio --libs correctly gives -Lf:/ProgramFiler-x86/libiio/lib -liio.

gvanem avatar Apr 06 '22 08:04 gvanem

Honestly, we don't use pkg-config on Windows because it's a pain. However if you think this should be fixed, it's just a matter of setting the correct library name in libiio.pc.cmakein from one of the CMake variables.

pcercuei avatar Apr 07 '22 11:04 pcercuei

@pcercuei , I don't know if that works...

man page:

--msvc-syntax
This option is available only on Windows. It causes pkg-config to output -l and -L flags in the form recognized
by the Microsoft Visual C++ command-line compiler, cl. Specifically, instead of 
-Lx:/some/path it prints /libpath:x/some/path, and instead of -lfoo it prints foo.lib. Note that the --libs output
consists of flags for the linker, and should be placed on the cl command line after a /link switch.

so I think it's doing exactly what it is supposed to - if you change the libiio.pc.cmakein - for MSVC - it will break for mingw.

Isn't the fix to take: https://github.com/analogdevicesinc/libiio/blob/master/CMakeLists.txt#L469 and make it "iio.dll" only?

Thanks -Robin

rgetz avatar Oct 21 '22 15:10 rgetz