FindThreads: move checking of the -pthread compiler flag into a macro

This allows a following commit to introduce a switch to prefer that check over
searching for the explicit library names without breaking backward
compatibility.
FindThreads: introduce an imported target to link to

This not only holds the library, but can also hold compiler flags needed, e.g.
the -pthread flag preferred by gcc on some platforms. There was no clean way
to get that compiler flag from the module until now.
FindThreads: introduce THREADS_PREFER_PTHREAD_FLAG (#14767)
Merge topic 'FindThreads_overhaul' into next

89a51d50 FindThreads: introduce THREADS_PREFER_PTHREAD_FLAG (#14767)
d7c209ed FindThreads: introduce an imported target to link to
46368edd FindThreads: move checking of the -pthread compiler flag into a macro