Can't force find_library to find .dll suffix

When executing find_library in
find_library(PostgreSQL_LIBRARIES NAMES libpq.dll pq

it debug report indicate
NAMES: “libpq.dll”

find_library considered the following locations:

The item was found at
So it finds only static and ignores .dll.
If “pq” is removed , the library is not being found:
NAMES: “libpq.dll”

The item was not found despite valid file is there
Why is .dll ignored and how to force cmake to find it?

Under Windows, you don’t link against the DLL file but against a stub .lib file. The DLL is used only when running the application. That’s probably what cmake searches for.

This is not “under Windows”, but on Linux cross compiling to run on Windows target using mingw64 toolchain. So the dependent library libpq.dll is built 1st and then libpqxx library also has to be built on Linux, It will be used in the emulator wine and on Windows 10.
Additional info: Te issue is that when building libpqxx (with libpq as dependent) error comes up:
Linking CXX shared library libpqxx.dll
CMakeFiles/pqxx_shared.dir/objects.a(connection_base.cxx.obj):connection_base.cxx:(.text+0x8eac): undefined reference to `__imp_select’