FindThreads: Redesign
The FindThreads module is one of the oldest in CMake, and conventions have evolved a lot over time. As of CMake 3.23, the module's logic is hard to follow, does not use modern conventions, and produces result variables with atypical names. Also, it may be performing more try_compile
checks than needed. We need to consider a redesign:
- Provide modern result variable names (and old ones only for compatibility).
- Clean up the logic to use a more consistent approach for each check.
- Encode information in compiler/platform information modules to narrow down the search. For example, we should be able to memorize which compilers potentially have the
-pthread
flag.