cli: fix uncaught exception

an exception was uncaught in the CLI when creating a package
package: fix the extension detection of libraries

Using the macro G_OS_WINDOWS does not work, use instead
classical macros _WIN32, etc..